Skip to content

Commit 3965287

Browse files
authored
fix/recover from webhook goroutines (#1858)
* handle crashes in goroutine events * include stacktrace in errors
1 parent 6b2ee65 commit 3965287

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

backend/controllers/github.go

+9
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import (
2626
"os"
2727
"path"
2828
"reflect"
29+
"runtime/debug"
2930
"slices"
3031
"strconv"
3132
"strings"
@@ -312,6 +313,10 @@ func handlePullRequestEvent(gh utils.GithubClientProvider, payload *github.PullR
312313
defer func() {
313314
if r := recover(); r != nil {
314315
log.Printf("Recovered from panic in handlePullRequestEvent handler: %v", r)
316+
log.Printf("\n=== PANIC RECOVERED ===\n")
317+
log.Printf("Error: %v\n", r)
318+
log.Printf("Stack Trace:\n%s", string(debug.Stack()))
319+
log.Printf("=== END PANIC ===\n")
315320
}
316321
}()
317322

@@ -693,6 +698,10 @@ func handleIssueCommentEvent(gh utils.GithubClientProvider, payload *github.Issu
693698
defer func() {
694699
if r := recover(); r != nil {
695700
log.Printf("Recovered from panic in handleIssueCommentEvent handler: %v", r)
701+
log.Printf("\n=== PANIC RECOVERED ===\n")
702+
log.Printf("Error: %v\n", r)
703+
log.Printf("Stack Trace:\n%s", string(debug.Stack()))
704+
log.Printf("=== END PANIC ===\n")
696705
}
697706
}()
698707

0 commit comments

Comments
 (0)