Repository navigation
Conversation
Member
|
probably replaced by #634 |
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
2F94
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.
Overview
This PR fixes a nil pointer dereference in
gateway.listenwhen handlingEventResumedafter a connection reset or invalid session, as reported in #631.Root Cause
When a gateway connection receives
OpcodeInvalidSessionwithcanResume == falseor experiences a reconnect sequence,g.config.SessionIDis cleared tonil. If anEventResumedevent is subsequently processed,gateway.go:658unconditionally dereferences*g.config.SessionIDfor the debug log:This triggers a fatal SIGSEGV panic (
addr=0x0).Changes
gateway/gateway.go(EventResumed): Guardg.config.SessionIDwith a nil check before loggingsession_id.gateway/gateway.go(resume): Add a defensive guard check inresume()so it returns an error instead of panicking if called without a session ID or sequence number.Closes #631