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

abortConnection may throw EPIPE exception #596

Closed
1 of 2 tasks
mingc00 opened this issue Feb 6, 2020 · 0 comments
Closed
1 of 2 tasks

abortConnection may throw EPIPE exception #596

mingc00 opened this issue Feb 6, 2020 · 0 comments

Comments

@mingc00
Copy link

mingc00 commented Feb 6, 2020

Note: for support questions, please use one of these channels: stackoverflow or slack

You want to:

  • report a bug
  • request a feature

Current behaviour

Application terminated by uncaught exception.

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

Error: write EPIPE
at afterWriteDispatched (internal/stream_base_commons.js:150:25)
at writeGeneric (internal/stream_base_commons.js:141:3)
at Socket._writeGeneric (net.js:771:11)
at Socket._write (net.js:783:8)
at doWrite (_stream_writable.js:431:12)
at writeOrBuffer (_stream_writable.js:415:5)
at Socket.Writable.write (_stream_writable.js:305:11)
at abortConnection (/volume1/@appstore/Spreadsheet/server/node_modules/engine.io/lib/server.js:506:12)
at /volume1/@appstore/Spreadsheet/server/node_modules/engine.io/lib/server.js:353:7
at Server.verify (/volume1/@appstore/Spreadsheet/server/node_modules/engine.io/lib/server.js:158:14)
Emitted 'error' event on Socket instance at:
at errorOrDestroy (internal/streams/destroy.js:108:12)
at onwriteError (_stream_writable.js:446:5)
at onwrite (_stream_writable.js:473:5)
at internal/streams/destroy.js:50:7
at Socket._destroy (net.js:664:5)
at Socket.destroy (internal/streams/destroy.js:38:8)
at afterWriteDispatched (internal/stream_base_commons.js:150:17)
at writeGeneric (internal/stream_base_commons.js:141:3)
at Socket._writeGeneric (net.js:771:11)
at Socket._write (net.js:783:8) {
  errno: 'EPIPE',
  code: 'EPIPE',
  syscall: 'write'
}

Steps to reproduce (if the current behaviour is a bug)

  1. make Server be busy.
io.use(function(socket, next) {
  const time = Date.now() + 60000); // 1min
  while (Date.now() < time) {} // busy task
  next();
});
  1. Client try to connect the socket.io server.
  2. Close browser tab. ( abortConnection)
  3. server may got EPIPE error.

Expected behaviour

Error should be ignore.

Setup

  • OS: Node.js v12.14.1
  • browser: Chrome
  • engine.io version: 3.4.0

Other information (e.g. stacktraces, related issues, suggestions how to fix)

Add error handler before socket.write, otherwise EventEmitter will throw exception.

socket.once('error', function() { /* ignore */ });
socket.write(...);
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

1 participant