MacOS test test_sync_connect_hook_rejected_fails can hang
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 72/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- rust
- Ambito
- backend, networking
Direzione di ricerca
Start in server.rs: read Connection::shutdown (around lines 118-119), the client_handler loop blocked at control_rx.recv() (line 665), and the reader thread's exit paths feeding control_tx_reader. The described fix is to have the reader always send on control_tx_reader when leaving its loop, not only on error paths. Then run the reproduction command from the issue against the test binary for test_sync_connect_hook_rejected_fails to confirm no runs hang under timeout 20.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Description of problem
Run multiple instances of the test binary on MacOS at the same time, like this:
BIN=$(cargo test --features sync,security_extension --test hook_integration_sync_unix --no-run 2>&1 \
| grep -oE 'target/debug/deps/hook_integration_sync_unix-[0-9a-f]+')
seq 1 800 | xargs -P 8 -I{} sh -c \
"timeout 20 $BIN test_sync_connect_hook_rejected_fails --exact >/dev/null 2>&1; [ \$? -eq 124 ] && echo 'run {} hung'"
This happened in the CI run of PR #314 for example.
Expected result
All tests pass
Actual result
Some tests hang.
Analysis
What the stack trace shows
- The test thread is stuck in Server::shutdown() → disconnect(), waiting for the reaper thread to finish (server.rs:784).
- The reaper waits for the connection's client_handler thread.
- client_handler is blocked forever in control_rx.recv() (server.rs:665).
- The response thread is still waiting on res_rx, because client_handler still holds res_tx.
- The reader thread and all method-handler threads have already exited.
Why it deadlocks
This is a race between shutdown() and a connection the server has only just accepted:
- The client connects. The hook rejects it and the client closes the fd straight away. Unlike the other tests, no request is ever sent, so nothing ensures the server has finished setting up the connection.
- The listener accepts the connection and spawns client_handler, just as the test calls server.shutdown().
disconnect() calls Connection::shutdown(), which sets quit = true (server.rs:118-119). - The reader thread and the newly started method-handler threads see quit == true at the top of their loops and exit without sending anything on control_tx.
- client_handler had already checked quit and entered control_rx.recv(). It holds its own control_tx clone, so recv() never returns an error, and nothing else is left to send. It blocks forever.
Possible fix
have the reader thread always send on control_tx_reader when it leaves its loop, not only on its error paths. A send after client_handler has gone fails harmlessly, because control_rx is dropped before the reader is joined. Alternatively, the test could send one request before shutdown() so the connection is fully set up, but that only hides the server bug.
- Lingua principale
- Rust
- Stelle
- 374
- Fork
- 64
- Merge medio
- 3g 5h
- PR unite (30g)
- 6
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 containerd/ttrpc-rust
-
Async server reorders and drops client-stream DATA framesForse già presa @shvbsle l’ha presa 19 giorni fa. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 15/100
containerd/ttrpc-rust#340 ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
containerd/ttrpc-rust#317 · 1 commento ·
-
Add single connection support to ServerForse già presa @KarstenB l’ha presa 204 giorni fa. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 42/100
containerd/ttrpc-rust#293 ·
-
Can the asynchronous client connect operation support asynchronous mode to avoid connect blocking?Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
containerd/ttrpc-rust#265 · 1 commento ·
-
Please update `protobuf` to the latest v3.5.1 version for both ttrpc-codegen and ttrpc-compilerAperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 42/100
containerd/ttrpc-rust#237 ·
Tutte le issue di containerd/ttrpc-rust
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
area: plugins bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
clipy-recorder/clipy#1039 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
valkey-io/valkey-glide#7975 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
gofractally/psibase#2379 ·
I maintainer di solito rispondono entro 3 giorni
-
Qwen stream parser: a chunk with "error": null is treated as a stream errorForse già presa @Beehtrix l’ha presa oggi. Apertaarea:models bug good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
brekkylab/ailoy#681 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni