Reporting Unrecovered Panics
I maintainer di solito rispondono entro 2 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 25/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Da chiarire
- Stato di attività
- Ferma
- Stack tecnologico
- go
- Ambito
- observability-sre
Direzione di ricerca
Inizia esaminando l’inizializzazione dell’SDK in sentry.Init e la chiamata differita a sentry.Flush, quindi analizza come Go scrive su stderr le tracce dei panic non recuperati prima della terminazione del processo. L’issue non identifica file, test o un’implementazione definita; il lavoro sarebbe completato quando sarà stato concordato un design e sarà stato verificato che i panic non recuperati delle goroutine vengano segnalati senza dipendere dai core dump.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Problem Statement
The current SDK will not report a panic if it isn't caught in a recover. The following example does not report any errors to Sentry. Panics and unhandled crashes are arguably the highest value errors an SRE would want to monitor and alert on in a production environment.
By default, Go will print the panic trace to stderr before exiting, but there is no opportunity for another go routine to recover the panic before the process terminates (note the absence of "Main exiting" in the output below).
There are a whole host of reasons a go program could panic, from data races to nil pointer dereferences, and there does not seem to be a good way to enforce panic recovery in every single go routine a developer might add to the codebase.
package main
import (
"log"
"time"
"github.com/getsentry/sentry-go"
)
func main() {
// Initialize Sentry SDK
err := sentry.Init(sentry.ClientOptions{
Dsn: "https://[email protected]/your-project",
Debug: true,
})
if err != nil {
log.Fatalf("sentry.Init: %s", err)
}
defer sentry.Flush(2 * time.Second)
// Main goroutine recovery attempt (won't help)
defer func() {
if r := recover(); r != nil {
log.Println("Main recovered:", r)
}
}()
// Start problematic goroutine
go func() {
panic("goroutine panic - unrecovered")
}()
// Keep main alive to observe behavior
time.Sleep(1 * time.Second)
log.Println("Main exiting")
}
Ouputs:
...
[Sentry] 2025/02/20 16:41:01 Integration installed: GlobalTags
panic: goroutine panic - unrecovered
goroutine 24 [running]:
main.main.func2()
/Users/chodges/go-panic/panic.go:29 +0x2c
created by main.main in goroutine 1
/Users/chodges/go-panic/panic.go:28 +0xbc
Solution Brainstorm
Triggering a core dump is one way to get around this problem and report the error to Sentry, however that has its own set of drawbacks:
- Exposes sensitive data
- Generates large files which could fill the disk
- High file I/O could compromise performance of the compute node
Another option would be to take a config option in the SDK initialization that has a file path to stderr output for the process. Then on SDK startup, it could go through the stderr output and look for panic stack traces and report them to Sentry. Parsing logs for errors is messy, but given how Golang handles unrecovered panics there is really nothing that can be done with error handling post-panic and before process termination.
- Lingua principale
- Go
- Stelle
- 1.1k
- Fork
- 264
- Merge medio
- 2g 6h
- PR unite (30g)
- 11
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di getsentry/sentry-go
-
ExtractStacktrace resolves the PCs of []runtime.Frame stack traces a second timeForse già presa @mokevnin l’ha presa 21 giorni fa. ApertaErrors Go
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
getsentry/sentry-go#1461 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni
-
v1 API refinementsAperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
getsentry/sentry-go#1485 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni
-
Crons: gocron job monitoringApertaChecks Crons Feature Go
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
getsentry/sentry-go#1470 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni
-
Checks Crons Go Improvement
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
getsentry/sentry-go#1468 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni
-
Crons: WithMonitor helperApertaChecks Crons Feature Go
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
getsentry/sentry-go#1467 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni
Tutte le issue di getsentry/sentry-go
Issue simili
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 64/100
I maintainer di solito rispondono entro 1 giorno
-
bug raised-by:verifier
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
medici-finance/assay#5697 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
sonatype-nexus-community/terraform-provider-sonatypeiq#101 ·
I maintainer di solito rispondono entro 1 giorno
-
area: metrics area: tracing contribfest enhancement good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
open-telemetry/opentelemetry-ebpf-instrumentation#4188 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
blinklabs-io/dingo#6074 ·
I maintainer di solito rispondono entro 1 giorno