Max call stack size exceeded on Connection.close #54
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I have a periodic service in nodejs that tries to create 30-40 socket connections and close it in case (it gets connected successfully or some error occurs while connecting) but every now an then I get Maxmimum call stack size exceeded error at line
connection.close()My Code structure
Error Screenshot

I am also open to other better ways to do this, basically what I need to do is check every few minutes whether socket servers are accepting connection or not.
i have the same problem when close browser or refresh browser
Hi, the problem here seems to be a loop
error->close->error-> ...The
errorevent will naturally also close the socket (https://github.com/sitegui/nodejs-websocket#event-errorerrobj), normally you don't have to explicit call it.However, the lib shouldn't crash when someone does it :)
This happens because a call to
close()(by WebSocket spec) does not close the socket right away. First it tries to inform the peer the connection will be dropped by a given reason. The underlying call towriteerrors and cycleerror->close->write->error-> ... beginsI don't have the time to fix this issue for now, however I'm open for a PR if you want to dive into the code.
Best regards,