Skip to content

Commit

Permalink
fix/recover from webhook goroutines (#1858)
Browse files Browse the repository at this point in the history
* handle crashes in goroutine events

* include stacktrace in errors
  • Loading branch information
motatoes authored Dec 17, 2024
1 parent 6b2ee65 commit 3965287
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions backend/controllers/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"os"
"path"
"reflect"
"runtime/debug"
"slices"
"strconv"
"strings"
Expand Down Expand Up @@ -312,6 +313,10 @@ func handlePullRequestEvent(gh utils.GithubClientProvider, payload *github.PullR
defer func() {
if r := recover(); r != nil {
log.Printf("Recovered from panic in handlePullRequestEvent handler: %v", r)
log.Printf("\n=== PANIC RECOVERED ===\n")
log.Printf("Error: %v\n", r)
log.Printf("Stack Trace:\n%s", string(debug.Stack()))
log.Printf("=== END PANIC ===\n")
}
}()

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

Expand Down

0 comments on commit 3965287

Please sign in to comment.