Skip to content

server: fix router DELETE hang from a lost child exit command - #28755

Closed
ServeurpersoCom wants to merge 1 commit into
ggml-org:masterfrom
ServeurpersoCom:server-router-child-exit-no-lookup
Closed

ServeurpersoCom wants to merge 1 commit into
ggml-org:masterfrom
ServeurpersoCom:server-router-child-exit-no-lookup

Conversation

@ServeurpersoCom

@ServeurpersoCom ServeurpersoCom commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Overview

Superseded by #28762

The exit command for a download child is routed through a lookup in the model mapping, guarded by the models mutex, so a DELETE that erases the entry first leaves the lookup empty and the child never learns it should quit. It waits on stdin, its stdout never reaches EOF, and the DELETE blocks on th.join() until the 600s client timeout. The log thread already owns the subprocess, so the exit goes straight to it.

Additional information

Reproduced by widening the window with a 2s sleep between publishing the completion and sending the exit, identical in both binaries: the baseline hangs with no exit command ever sent and the router log goes silent right after the download_finished chunk, exactly as in CI, while the patched one returns in 2.11s and the child exits with status 0. pytest unit/test_router.py passes 17/17. Over the last week of Server runs this accounts for half of the test_router_delete_model timeouts; the other half is a download child that acknowledges the exit, finishes cleanly, and still never reaches EOF, which this does not address.

Requirements

The exit command for a download child is routed through a lookup in the
model mapping, guarded by the models mutex. A DELETE that erases the
entry first, or any long hold on that mutex, leaves the lookup empty and
the child never learns it should quit. It waits on stdin, its stdout
never reaches EOF, the monitoring thread stays in log_thread.join() and
the DELETE blocks on that join until the client times out.

The log thread runs inside the monitoring thread, which already owns the
subprocess, so the exit goes straight to it.
@ServeurpersoCom
ServeurpersoCom requested a review from a team as a code owner September 11, 2026 11:54
@ServeurpersoCom

ServeurpersoCom commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor Author

I sent my agent through every red Server run of the past week to sort the Windows flakes by root cause, here is what it found :

cause                              jobs (7d)  share of router  status

download_finished command lost        42           80%         PR #28747
behind the ANSI reset

DELETE 600s, exit command              5           10%         this PR, or #28762
never sent to the child

DELETE 600s, exit acknowledged         5           10%         #28762 only
but EOF never reached

test_completion_unified               20            -          PR #28759
returning 500

build / infra, misc                   22            -          out of scope

#28747
#28759
#28762

@ServeurpersoCom

Copy link
Copy Markdown
Contributor Author

Heads up, this one and #28762 fix the same hang in the same block, so please take one or the other but not both, they will conflict. #28762 is the broader of the two: it also covers the case where the child acknowledges the exit and still never reaches EOF, which is the other half of the failures I see in CI.

@ServeurpersoCom

Copy link
Copy Markdown
Contributor Author

Superseded by #28762

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants