Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

fix(provider/cloudflare): drain stderr pipe to prevent cloudflared process deadlock

Aperta
#54 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
76/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
go
Ambito
cli, networking

Direzione di ricerca

Start with internal/provider/cloudflare.go, focusing on requestTunnel and how its stderr scanner handles the matched URL and process lifetime. Then inspect the related provider tests and add coverage for a long-running child that writes beyond 64KB; done means stderr continues draining until the process exits or the context is cancelled, and the child does not block.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug

Description

In internal/provider/cloudflare.go (requestTunnel), Expose reads cloudflared's stderr pipe line by line to extract the assigned public tunnel URL.

Once the URL regex matches, the reading goroutine calls urlCh <- url and immediately exits:

if url := urlRegex.FindString(line); url != "" {
    urlCh <- url
    return // <--- scanner terminates here
}

Problem & Impact

When the scanner goroutine returns, nobody is reading from stderr anymore.

As cloudflared continues running in the background, it writes connection logs and request diagnostics to stderr. Once the OS pipe buffer (~64KB on Linux and macOS) fills up, cloudflared's subsequent write() syscall to stderr blocks indefinitely. This causes the tunnel process to freeze/deadlock, preventing any traffic from being tunneled.

Proposed Solution

Keep reading or draining the stderr pipe in the background for the entire lifecycle of the cloudflared process until EOF:

go func() {
    // Keep draining so the OS pipe buffer never fills up
    _, _ = io.Copy(io.Discard, stderr)
}()

Acceptance Criteria

  • Ensure stderr pipe is continuously drained until cmd finishes or context is cancelled.
  • Add unit test verifying that long-running child process writes beyond 64KB do not block.
Lingua principale
Go
Stelle
9
Fork
1
Merge medio
5h 57m
PR unite (30g)
15

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di kernelshard/expose

Tutte le issue di kernelshard/expose

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.