Repository navigation
[fix] Keep the storage worker alive when a request fails outside its handlers - #204
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bb0111276c
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| self._process_one_worker_request(worker_socket, monitor) | ||
| try: | ||
| self._process_one_worker_request(worker_socket, monitor) | ||
| except Exception as e: |
There was a problem hiding this comment.
Replace the worker socket after multipart I/O errors
When recv_multipart() or send_multipart() raises after consuming or emitting only part of a multipart message, this handler logs the exception and reuses the same DEALER socket. PyZMQ performs multipart I/O frame by frame, so unread frames or an outstanding SNDMORE envelope remain on that socket; the next request can then treat a payload frame as its identity or append its response to the previous caller's route, producing malformed replies and stranding an additional caller. Discard and recreate the worker socket (and update the poller), or terminate the unit, rather than continuing on a potentially poisoned socket.
Useful? React with 👍 / 👎.
|
[AI Review] [P2] Recreate the worker socket after multipart I/O failures Logging the exception and continuing with the same DEALER socket can leave an unfinished multipart message. The next response may then be appended to the previous response and routed to the wrong client. I reproduced this by injecting a Please close and recreate the worker socket after multipart I/O failures and update the poller accordingly. The new test raises only after receiving a complete request, so it does not cover failures between frames. A regression test should inject a failure between response frames and verify that the next client receives its own valid response. |
6f3b062 to
6d75a5f
Compare
|
Thanks for your review. Fixed in latest commit: after a failed request the worker closes its socket and connects a fresh one. The test now fails right after the identity frame and checks that the next client gets its own reply and the stranded one receives nothing. |
|
[AI Review] CI timeout: the replacement worker socket leaks during shutdown after merging main I reproduced the shutdown hang on the exact CI merge result, The root cause is an interaction with the worker-loop refactor now on main:
The new Recommended fix Give The poller is discarded when the loop exits, so final cleanup only needs to close the current socket; it does not need to unregister it. Keep the unregister operation when replacing a socket while the loop is still running. Validation: an in-memory change moving the current-socket close into |
…handlers A storage unit has a single worker thread. `recv_multipart` and the final `send_multipart` in `_process_one_worker_request` were outside any try block, so one failure there ended the thread while the proxy kept queueing requests nobody would answer, and `shutdown()` then blocked in `zmq_context.term()` on the dead worker's socket. Catch and log per request so only that caller times out. Also warn (once per hang, with ip:port) when a metrics probe times out: it is served by the same worker, so it is the earliest sign a unit stopped answering. Signed-off-by: huniu20 <[email protected]>
Multipart I/O can fail between frames and leave the DEALER mid-message, so the next reply would be appended to the stranded caller's route. Close the socket, which drops the unfinished message, and connect a fresh one. The regression test fails after the identity frame and checks the next caller gets its own reply. Signed-off-by: huniu20 <[email protected]>
c6ad504 to
4ac95ab
Compare
|
Thanks — fixed in latest, and rebased on main. |
A storage unit has one worker thread.
recv_multipartand the finalsend_multipartin_process_one_worker_requestwere not guarded, so one failure there killed the worker: the proxy kept queueing requests nobody answered, andshutdown()hung inzmq_context.term(). Catch per request so only that caller times out.Also warn once per hang (with ip:port) when a metrics probe times out, since it shares that worker.