fix(aggregator): guard nil subscription in SubscribeToNewTasksV3 error goroutine - #2294
Open
Sertug17 wants to merge 1 commit into
Open
Conversation
…r goroutine When the primary RPC WebSocket subscription fails on startup but the fallback succeeds, the error-handling goroutine called sub.Err() on a nil event.Subscription interface, causing an immediate nil pointer dereference panic. Introduce nilSafeErrCh() which returns a never-sending channel when the subscription is nil, so the select statement in the goroutine degrades gracefully instead of panicking. Resubscription after a recovered error now also updates the local channel variable (subErrCh / subFallbackErrCh) so the fix stays effective throughout the lifetime of the goroutine. Fixes yetanotherco#2293
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.
Closes #2293
Problem
When the primary RPC WebSocket subscription fails on startup but the fallback succeeds, the error-handling goroutine called
sub.Err()on a nilevent.Subscriptioninterface causing an immediate nil pointer dereference panic that crashes the aggregator.Fix
Introduce
nilSafeErrCh()which returns a never-sending channel when the subscription is nil. The select statement in the goroutine now degrades gracefully instead of panicking. The channel variable is also refreshed after each successful resubscription so the fix stays effective for the lifetime of the goroutine.Reproduction
SubscribeToNewTasksV3Retryablereturns(nil, err)for mainsub.Err()panics immediately