-
Notifications
You must be signed in to change notification settings - Fork 450
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
[ERR_STREAM_DESTROYED] seems sharedb is not closing connections #282
Comments
I'm curious, if you swap out |
I end up with using custom json stream and everything works right now. I also moved to SockJs. But it is denitely teamwork issue. |
ShareDB is not cleaning up old connections in this case. It would be possible to add a workaround in A better fix would be to update ShareDB to clean up a connection when a |
Thanks @gkubisa for your insights! Are you saying the ShareDB implementation should look something like this? function cleanup() {
agent.backend.agentsCount--;
if (!agent.stream.isServer) agent.backend.remoteAgentsCount--;
agent._cleanup();
}
this.stream.on('end', cleanup);
this.stream.on('close', cleanup); // <------------- this would be the new part For now my workaround is to use the original |
Yes, the general idea is good, however, your code will reduce the agent counts twice for streams which emit both |
I cleaned up the solution in #283 . Thanks for reviewing! |
Curran's fix for this is published in [email protected] |
Hooray! Thanks @ericyhwang |
FWIW I'm still seeing this error pop up. This seems odd as the fix has been released, and I'm definitely using a version of ShareDB that contains the fix.
Error I'm seeing:
I'm using Webpack dev server which is doing automatic reloading all the time, which may or may not be related to this. |
@curran , could you provide a full stack trace? |
Realized this was coming from my code here: // Prevent server crashes on errors.
stream.on('error', error => {
console.log('WebSocket stream error: ' + error.message);
}); Removing that, here's the full stack trace:
|
Wait a minute - I was confused about which package was importing ShareDB, and the package in the stack trace was using |
The error is gone after upgrading. Sorry for the false alarm! Thank you @gkubisa for your willingness to help here. |
Hey! I just upgraded to teamwork streamer.
ShareDb: 1.0.0-beta.21
sharedb-mongo: 1.0.0-beta.8
reconnecting-websocket: 4.1.10
@teamwork/websocket-json-stream: 2.0.0
rich-text: 3.1.0
ws: 6.2.1
node: 11.13.0
npm: 6.9.0
When I open page, everything is working right. Submitting op works without issues. Then I refresh the page and after first submitOp it throws an error.
Error what is crashing node server:
Last data what reached server before crash (immediately after it)
UPDATE
I find out for every refresh is error duplicated.
So when I open page first time then the error comes only once.
When I refresh the page 10 times and let it connect everytime to ShareDb. Then the error is printed 10 times.
Seems like memory-leak?
I attached listener for stream#close and it is called everytime.
eg.:
The text was updated successfully, but these errors were encountered: