Skip to content

Conversation

@lp247
Copy link
Contributor

@lp247 lp247 commented Nov 24, 2025

This change addresses crashes caused by unhandled errors that occur when multiple packets with unknown correlation IDs are received consecutively. The connection pool attaches an error handler via connection.once('error', ...), which detaches the error handler after it has been invoked once. This error handler does not close the connection/socket. Further emitted errors will be handled as uncaught exceptions and will cause the program to exit, as the socket remains open when emitting this error and continues to listen for incoming messages. By destroying the socket and providing the appropriate error, we prevent the socket from handling any more packets, thus preventing uncaught exceptions.

Furthermore, by providing the error as a parameter to the socket destruction, we remain within the normal socket lifecycle, and all cleanup on socket closure is performed, which was previously also skipped entirely.

on-behalf-of: @SAP [email protected]

This change fixes crashes due to unhandled errors if more than one
packet with unknown correlation ID are received in succession. The
connection pool attaches an error handler via
`connection.once('error', ...)` which detaches the error handler after
being invoked once. Further emitted errors will be handled as uncaught
exceptions and exit the program. Also, the socket is not closed when
emitting this error and keeps listening for incoming messages. By
destroying the socket and providing the appropriate error we prevent
the socket from handling any more packets, thus preventing uncaught
exceptions.

Furthermore, by providing the error as parameter to the socket
destruction we stay within the normal socket lifecycle and all
clean up on socket closure is done, which was previously skipped
entirely.

on-behalf-of: @SAP [email protected]
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

Successfully merging this pull request may close these issues.

1 participant