You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Worker keeps running after an error on its command channel #1912
A worker whose command channel is closed by the main process keeps running when the close shows up as an error on the channel rather than a hang-up. In Server::run (lib/src/server.rs), the command channel token is handled like this:
Token(0) => {if event.is_error(){error!("error reading from command channel");continue;}if event.is_read_closed() || event.is_write_closed(){error!("command channel was closed");return;}
...
The error branch only logs and continues. With the channel registered edge-triggered, no further event comes for it, so the worker never leaves its event loop, and a caller joining the worker thread waits forever.
When the close is an error
The command channel is a Unix stream socket. On Linux, when one end is closed while it still holds data it has not read, the other end gets ECONNRESET (EPOLLERR) rather than a plain hang-up. So it is enough for the main process to send a command, not read the worker's answer (for instance after giving up waiting for it), and then close the channel.
Reproduction
With sozu-lib 2.3.2, on Linux:
Start an HTTP worker on a Channel::generate pair and wait for it to answer a Status.
Write a WorkerRequest (Status) on the command end, do not read the answer, wait ~300 ms so it lands.
Drop the command end.
The worker logs error reading from command channel and its thread is still running seconds later, every time. Without step 2 it logs command channel was closed and exits. Sending HardStop before dropping the channel ends it in both cases.
We hit this in Sōzune as an intermittent hang on shutdown (a slow worker had a late answer pending), and now send HardStop to every worker on shutdown.
Suggestion
Treat an error on the command channel like a close, and return, since the main process can no longer drive the worker.
Activity
chore(release): prepare 2.3.4 (#1920)