Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid open/rejection messages with Corestore replication on socket that has many Protomux channels. #79

Closed
zacharygriffee opened this issue Nov 9, 2023 · 4 comments

Comments

@zacharygriffee
Copy link

Possibly related: #45 (comment)

I am using protomux extensively with numerous channels on a hyperswarm socket where individual hypercores are being replicated fine to all the other computers.

I decided to just replicate batches of cores with a namespacing of Corestores.

I am getting invalid open (on client) and rejection messages (on server) that close the socket of channels. If I comment out the corestore replication everything works just fine. The individual cores that I replicate in this manner replicate just fine as well. This occurs on all micro-services I have going that the corestore replication is being utilized (nodejs and browser).

I have tried these variations of replication pseudo-code:

corestore.replicate(mux);
corestore.replicate(noiseSocket);
corestore.replicate(isInitiator, mux);
corestore.replicate(isInitiator, noiseSocket)

image

@mafintosh
Copy link
Contributor

Interesting! Do you have any test case we canxrun?

@zacharygriffee
Copy link
Author

I'll work on one, asap.

@zacharygriffee
Copy link
Author

My apologies, as the problem isn't particularly corestore related. The error occurs for me when there is any latency between the connection and the channel open. Here is what causes the error for me:

swarm1.on("connection", socket => {
    socket.on("error", e => {
        console.log("socket1 error", e);
    });

    console.log("Connection 1");
    mux1 = new Protomux(socket);

    channel1 = channel(mux1, hs => {
        console.log("mux1 channel opened", hs);
    });

// THIS latency caused the error
    sleep(100).then(
        () => {
            channel1.open("from mux1");
        }
    );

    core1.replicate(mux1);
    corestore1.replicate(mux1);
});

function channel(mux, channelOpen) {
   return mux.createChannel(
       {
           ...debugProtocolKey,
           onopen: channelOpen,
           handshake: c.utf8
       }
   );
}

Thanks for your attention. I'm sure I can work around this.

@zacharygriffee
Copy link
Author

zacharygriffee commented Nov 11, 2023

I wanted to follow up here. I been battling this problem going on 3 days which I thought I could get around but I can't. I finally produced tests that nails down the issue but its simple. The problem occurs with the Hyperswarm DHT relay so I'm going to post a n issue at Hyperswarm DHT relay about the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants