fix(api): recover from panics in the /start forward goroutine#181
Merged
Conversation
The inline goroutine in startChat that forwards the synthetic /start update (via updates.Push / relay.Send / sendWebhook) had no panic recovery, unlike its siblings forwardToBot and forwardCallback which both defer recoverLog. An unrecovered panic in a spawned goroutine crashes the whole process — the request-chain Recover middleware only covers the request goroutine, not ones it spawns. Guard it the same way. Add TestRecoverLog_RecoversGoroutinePanic locking the recovery primitive (a deferred recoverLog must swallow a goroutine panic).
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.
The inline goroutine in
startChatthat forwards the synthetic/startupdate (viaupdates.Push/relay.Send/sendWebhook) had no panic recovery, unlike its siblingsforwardToBotandforwardCallbackwhich bothdefer recoverLog. An unrecovered panic in a spawned goroutine crashes the whole process — the request-chainRecovermiddleware only covers the request goroutine, not ones it spawns.Guard it the same way, and add
TestRecoverLog_RecoversGoroutinePaniclocking the recovery primitive (a deferredrecoverLogmust swallow a goroutine panic).