forward: 1006 reconnect never triggers (wrapped error vs IsCloseError), and exits with a usage dump
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 72/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- go
- Ambito
- cli, networking
Direzione di ricerca
Inizia da webhook/forward.go, leggendo runFwd e handleWebsocket per tracciare come l'errore websocket avvolto raggiunge il controllo del retry. Verifica che le chiusure anomale effettuino un retry invece di terminare, che gli errori di runtime non stampino il dump dell'utilizzo e che il comportamento dopo sessioni ripetute o prolungate corrisponda al ciclo di vita previsto del forwarder.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
gh webhook forward has retry logic for a 1006 abnormal closure, but it never runs. The error is wrapped before it reaches the check, and websocket.IsCloseError does not unwrap. The result is that the command exits on the first server-side disconnect — and, because the command sets neither SilenceUsage nor SilenceErrors, prints its entire help text on the way out.
In my case GitHub closes the forwarding socket roughly every five minutes, so a long-running forward dies about twelve times an hour and each death writes ~26 lines of usage output. 73% of my log is cobra help text.
The cause
webhook/forward.go, in runFwd:
for i := 0; i < 3; i++ {
err := handleWebsocket(out, url, token, wsURL, activateHook)
if err != nil {
// If the error is a server disconnect (1006), retry connecting
if websocket.IsCloseError(err, websocket.CloseAbnormalClosure) {
time.Sleep(5 * time.Second)
continue
}
...
return err
}
}
handleWebsocket wraps the read error before returning it:
err := c.ReadJSON(&ev)
if err != nil {
return fmt.Errorf("error receiving json event: %w", err)
}
and gorilla/websocket v1.5.0's IsCloseError is a bare type assertion, not errors.As:
func IsCloseError(err error, codes ...int) bool {
if e, ok := err.(*CloseError); ok {
So the assertion fails on the wrapped error, the continue is unreachable, and runFwd returns immediately. The observed error confirms it — this is the wrapped text, not unable to connect to webhooks server, forwarding stopped, which is what exhausting the loop would produce:
Error: error receiving json event: websocket: close 1006 (abnormal closure): unexpected EOF
Suggested fix
var closeErr *websocket.CloseError
if errors.As(err, &closeErr) && closeErr.Code == websocket.CloseAbnormalClosure {
time.Sleep(5 * time.Second)
continue
}
and SilenceUsage: true on the command, since a runtime network error is not a usage error.
One more thing worth considering
Fixing the unwrap alone may not be enough for a long-running forwarder. i counts total disconnects across the process lifetime and is never reset after a successful session, so with a server that closes on a timer the command would still exit permanently after three closes — for me, about fifteen minutes. Resetting the counter after a session that lasted a meaningful length of time would make forward survivable as a long-running process.
Versions
gh2.98.0gh-webhookv0.2.0- macOS 15 (arm64)
- Lingua principale
- Go
- Stelle
- 43
- Fork
- 18
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
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 cli/gh-webhook
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
cli/gh-webhook#44 ·
-
ENTRY SHEETAperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 30/100
cli/gh-webhook#46 ·
-
Forwarding localhost gives `http: server gave HTTP response to HTTPS client`Forse di nuovo libera Una pull request per questa issue è stata chiusa senza essere unita. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 55/100
cli/gh-webhook#32 · 1 commento · 1 reazione ·
-
Did the websocket message payload keys change to lowercase?Forse di nuovo libera @williammartin l’ha presa 843 giorni fa e non c’è nessuna pull request aperta. Aperta
cli/gh-webhook#28 · 1 assegnatario ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 20/100
cli/gh-webhook#19 · 2 commenti · 1 reazione ·
Tutte le issue di cli/gh-webhook
Issue simili
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
open-telemetry/opentelemetry-go-compile-instrumentation#1467 ·
I maintainer di solito rispondono entro 3 giorni
-
Python 3.15 supportForse già presa @amnesiaof l’ha presa oggi. ApertaL: python L: python:uv
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
dependabot/dependabot-core#16524 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
duplication
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
openvibely/openvibely#1443 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 60/100
canonical/service-mesh#845 ·
I maintainer di solito rispondono entro 1 giorno