Repository navigation
server: fix router DELETE hang from a lost child exit command - #28755
Closed
ServeurpersoCom wants to merge 1 commit into
Closed
ServeurpersoCom wants to merge 1 commit into
ServeurpersoCom wants to merge 1 commit into
Conversation
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.
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 : |
This was referenced Sep 11, 2026
CISC
approved these changes
Sep 11, 2026
ggerganov
approved these changes
Sep 11, 2026
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. |
Contributor
Author
|
Superseded by #28762 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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