Repository navigation
Conversation
…-init
A re-init (initPushConnection) calls removeAllListeners() and disconnect()
on the old push instance while its token refresh request is still in
flight. When the token callback later resumes connect() and Amazon drops
the connection mid-TLS-handshake, the http2 session re-emits the socket
error on the session, which forwards it to this.emit('error') on the
push — and with no listeners left, EventEmitter throws and kills the
whole process.
Two changes:
- connect() bails out if the push was stopped while waiting for the
token, so a disconnected push never opens a socket.
- All this.emit('error') sites are guarded by a listener count check,
so a listener-less push can never throw an uncaught exception.
Co-Authored-By: Claude Code <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
My node-red instance was dying every few days with the message:
Traced it to node-red-contrib-alexa-remote2-applestrudel with a global socket tracker and these were the responsible sockets: