nighthawk_client can hang at startup: unconditional fork() of a multithreaded process

Aperta
#1,609 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 3 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
68/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
cpp
Ambito
cli

Direzione di ricerca

Inizia da ProcessImpl::run() e EncapsulationSubProcessRunner, quindi riproduci il problema con il comando nighthawk_client mostrato con 1 worker e senza --tunnel-uri. Il lavoro è completato quando l’avvio termina e le richieste vengono inviate senza eseguire il fork quando non è configurato alcun tunnel, mentre il comportamento con il tunnel abilitato continua a essere coperto dai test esistenti pertinenti.

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

Descrizione

Title: nighthawk_client can hang at startup: unconditional fork() of a multithreaded process

Description:
ProcessImpl::run() always goes through EncapsulationSubProcessRunner, which fork()s a child even when no --tunnel-uri is configured. In that case the child only posts a process-shared semaphore and _exit()s while the parent blocks in sem_wait(). The parent is already multithreaded at that point (at least the SignalHandler thread; in -c opt builds also the allocator's state), so the child can deadlock on a lock held by a thread that does not exist in it before reaching sem_post(). The client then hangs indefinitely without sending a request. Expected: no fork unless a tunnel is actually requested.

Reproduction steps:
Timing dependent. Observed on a 1-worker nighthawk_client --open-loop --rps 4000 --duration 110 ... (no tunnel) started in a tight loop of runs against a gRPC server on arm64; roughly 1 in 15 runs hung.

Logs:
The last lines before the hang (the fork happens right after them):

[I] Starting 1 threads / event loops. Time limit: 110 seconds.
[I] Global targets: 8 connections and 4000 calls per second.

then nothing for 38 minutes.

Call Stack:
Not a crash. Process state from /proc: parent pid with two threads, main in __futex_wait (utime 6 ticks) and one in anon_pipe_read (the signal handler thread); a child process with the same argv, single thread, utime 0, never ran.

Lingua principale
C++
Stelle
420
Fork
99
Merge medio
2g 14h
PR unite (30g)
17

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 envoyproxy/nighthawk

Tutte le issue di envoyproxy/nighthawk

Issue simili

Altre issue su C++

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.