fix: recover panics in the fetchUserTokens worker goroutine#105
Open
robert-chiniquy wants to merge 1 commit into
Open
fix: recover panics in the fetchUserTokens worker goroutine#105robert-chiniquy wants to merge 1 commit into
robert-chiniquy wants to merge 1 commit into
Conversation
fetchUserTokens spawns a bounded worker pool that fans out one
goroutine per user, each calling client.ListTokens and downstream
Google SDK code. None of the workers had a defer recover(), so a
panic in any user's token-fetch path crashed the entire connector
process rather than just failing that user's sync.
Added a defer recover() at the top of the worker that logs the
panic + stack via the existing zap logger and lets the goroutine
exit; the user's slot in results stays at its zero value
(userAppsResult{}) so the outer loop treats the user as having
no enumerable apps. The semaphore Release + wg.Done defers fire
normally so the pool unwinds cleanly.
How found: occult-go-analysis baton pool scan (2026-05-20),
detector goroutine_without_recover.
Contributor
Connector PR Review: fix: recover panics in the fetchUserTokens worker goroutineBlocking Issues: 0 | Suggestions: 0 | Threads Resolved: 0 Review SummaryThis PR adds a Security IssuesNone found. Correctness IssuesNone found. SuggestionsNone. |
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.
`fetchUserTokens` spawns a bounded worker pool that fans out one goroutine per user, each calling `client.ListTokens` and downstream Google SDK code. None of the workers had a `defer recover()`, so a panic in any user's token-fetch path crashed the entire connector process rather than just failing that user's sync.
Added a `defer recover()` at the top of the worker that logs the panic + stack via the existing zap logger and lets the goroutine exit; the user's slot in `results` stays at its zero value (`userAppsResult{}`) so the outer loop treats the user as having no enumerable apps. The semaphore `Release` + `wg.Done` defers fire normally so the pool unwinds cleanly.
How found: occult-go-analysis baton pool scan (2026-05-20), detector `goroutine_without_recover`.