server: fix Windows CI flake from the log color reset - #28747
ServeurpersoCom merged 1 commit into
Conversation
The child writes its state commands on stdout while the logger writes on stderr, and both share a single pipe. The logger emits the trailing color reset after the newline of a debug, warn or error entry, so that escape sequence has no newline of its own and the router reads it glued in front of the next command. The line prefix check then fails and the command is forwarded as a log line instead of being handled, which leaves a finished download stuck in the downloading state. Writing the command with a leading newline closes the pending line so it always starts at a line boundary.
|
This is supposed to fix failures such as: https://github.com/ggml-org/llama.cpp/actions/runs/34582172702/job/103208051836#step:6:2054 |
|
Yes for the test_router_download_model failure in that job, its only command line is download_finished and it arrives with the reset glued in front of it. The test_router_delete_model failure in the same job is a different one though: there download_finished is handled correctly and the SSE event goes out, but DELETE /models still hangs the full 600s because the download child never closes its stdout, so the monitoring thread never joins. I open a separate PR for that one. |
|
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 : |
…g#28747) The child writes its state commands on stdout while the logger writes on stderr, and both share a single pipe. The logger emits the trailing color reset after the newline of a debug, warn or error entry, so that escape sequence has no newline of its own and the router reads it glued in front of the next command. The line prefix check then fails and the command is forwarded as a log line instead of being handled, which leaves a finished download stuck in the downloading state. Writing the command with a leading newline closes the pending line so it always starts at a line boundary.
…g#28747) The child writes its state commands on stdout while the logger writes on stderr, and both share a single pipe. The logger emits the trailing color reset after the newline of a debug, warn or error entry, so that escape sequence has no newline of its own and the router reads it glued in front of the next command. The line prefix check then fails and the command is forwarded as a log line instead of being handled, which leaves a finished download stuck in the downloading state. Writing the command with a leading newline closes the pending line so it always starts at a line boundary.
…g#28747) The child writes its state commands on stdout while the logger writes on stderr, and both share a single pipe. The logger emits the trailing color reset after the newline of a debug, warn or error entry, so that escape sequence has no newline of its own and the router reads it glued in front of the next command. The line prefix check then fails and the command is forwarded as a log line instead of being handled, which leaves a finished download stuck in the downloading state. Writing the command with a leading newline closes the pending line so it always starts at a line boundary.
…g#28747) The child writes its state commands on stdout while the logger writes on stderr, and both share a single pipe. The logger emits the trailing color reset after the newline of a debug, warn or error entry, so that escape sequence has no newline of its own and the router reads it glued in front of the next command. The line prefix check then fails and the command is forwarded as a log line instead of being handled, which leaves a finished download stuck in the downloading state. Writing the command with a leading newline closes the pending line so it always starts at a line boundary.
Overview
On Windows the child logs in color, and the logger emits its reset after the newline. That stray escape lands in front of cmd_child_to_router:state: on the shared pipe, the prefix check fails, and download_finished is logged instead of handled, leaving the model stuck downloading. Hence the intermittent test_router_delete_model failures.
Additional information
A leading newline on the command fixes it. Reproduced on Linux with LLAMA_ARG_LOG_COLORS=on, keeping the cached blob while the registry no longer knows the model. pytest unit/test_router.py passes 17/17.
Requirements