socketio / socket.io-sticky

A simple and performant way to use Socket.IO within a cluster.
https://socket.io
MIT License
43 stars 13 forks source link

Unexpected error #1

Closed voicenter closed 3 years ago

voicenter commented 3 years ago

internal/per_context/primordials.js:23 return (thisArg, ...args) => ReflectApply(func, thisArg, args); ^

TypeError: Cannot convert undefined or null to object at hasOwnProperty () at internal/per_context/primordials.js:23:32 at getOrSetAsyncId (internal/async_hooks.js:396:7) at Server.connectionListener (_http_server.js:414:5) at Server.emit (events.js:315:20) at process. (C:\Users\Admin\WebstormProjects\socketIOClusterTest\node_modules\@socket.io\sticky\index.js:102:23) at process.emit (events.js:327:22) at emit (internal/child_process.js:903:12) at processTicksAndRejections (internal/process/task_queues.js:81:21)

Not sure why...

darrachequesne commented 3 years ago

Hi, I was not able to reproduce (and the CI for the test/windows branch was successful).

Thanks!

darrachequesne commented 3 years ago

I was indeed able to reproduce the issue while load testing my cluster.

According to this, the socket object could be undefined when reaching the child process, hence the exception.

Any 'message' handlers in the subprocess should verify that socket exists, as the connection may have been closed during the time it takes to send the connection to the child.

It should be fixed by https://github.com/socketio/socket.io-sticky/commit/7069fbc5bfbc845556f4a5cb8fd8240a1ef24b0e, included in version 1.0.1.

Thanks!