Repository navigation
Conversation
ac23d7e to
3a5dbf0
Compare
Benchmark, build and MongoDB tracer processes now run as tokio::process::Child, so waiting on them no longer blocks the async runtime. The FIFO command handler selects on incoming commands and on the child exiting, instead of checking try_wait only after a 1s idle timeout. A run therefore returns as soon as the benchmark process exits, rather than up to a second later. Child stdout and stderr are converted back to blocking files with into_owned_fd and read on blocking threads, so draining the logs does not depend on the current_thread runtime driving IO. Closes COD-3863 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
3a5dbf0 to
2c52924
Compare
Merging this PR will not alter performance
|
[High impact] The PR appears safe to merge. SummaryMoves benchmark, build, and MongoDB tracer processes to
No actionable issues were found.
|
| continue; | ||
| } | ||
| tokio::select! { | ||
| result = self.recv_cmd() => { |
There was a problem hiding this comment.
We must ensure that we don't accidentally discard events inside the FIFO when the process exits. I suggest we add biased; to the recv_cmd branch to ensure we always finish reading the FIFO first (see: https://docs.rs/tokio/latest/tokio/macro.select.html#fairness)
tokio::select! {
+ // Read commands already in the FIFO before acting on the exit.
+ biased;
result = self.recv_cmd() => {
Spawn the benchmark, build and MongoDB tracer processes with
tokio::processinstead ofstd::process, so waiting on a child no longer blocks the runtime.RunnerFifo::handle_fifo_messagesnow selects on incoming FIFO commands and onchild.wait(). Previously it only checkedtry_wait()afterrecv_cmdhad been idle for 1s, so each run returned up to a second after the benchmark process exited.Commands still unread when the child exits can be dropped, as before: the old loop could also time out, receive a command and see the exit in
try_wait()before reading it. Now the loop returns as soon aschild.wait()resolves, and if a command and the exit are ready at the same timeselect!picks one at random. What actually prevents lost commands is the ack: integrations send each command and block until the runner acks it, so they can't exit with a command unread.Child stdout and stderr are taken back as blocking files (
take_blocking_stdio, built oninto_owned_fd, which clearsO_NONBLOCK) and drained on blocking threads, as before.Closes COD-3863