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

Node 10: Unhandled 'error' event in wsServer.on('request') #351

Closed
ibc opened this issue Mar 7, 2019 · 3 comments
Closed

Node 10: Unhandled 'error' event in wsServer.on('request') #351

ibc opened this issue Mar 7, 2019 · 3 comments

Comments

@ibc
Copy link
Collaborator

ibc commented Mar 7, 2019

Completely related: nodejs/node#23169 (so this may be a bug in Node or a behaviour change).

Basically, if within the wsServer.on("request") event I reject the WS connection attempt (by calling request.reject(), there is an unhandled "error" event emitted by request.httpRequest.socket.

In Node 8 the socket emits "error" event, but nothing happens if there is no event listener for it. However in Node 10, if there is no listener for that "error" event, the whole process fails with:

events.js:167
      throw er; // Unhandled 'error' event
      ^

Error: read ECONNRESET
    at TLSWrap.onStreamRead (internal/stream_base_commons.js:111:27)
Emitted 'error' event at:
    at emitErrorNT (internal/streams/destroy.js:82:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:50:3)
    at process._tickCallback (internal/process/next_tick.js:63:19)

So, may be WebSocket-Node should at least place an empty "error" listener in the socket?

ibc added a commit to versatica/protoo that referenced this issue Mar 7, 2019
@theturtle32
Copy link
Owner

@ibc - Should we do this?

@ibc
Copy link
Collaborator Author

ibc commented Dec 8, 2019

I'm not sure. Maybe this problem was already addressed in this PR (already merged)?

#332

@theturtle32
Copy link
Owner

Could be

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