Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c37e1223b9
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| let std_stream = stream.into_std().context("converting to std stream")?; | ||
| // Keep non-blocking — AsyncFd handles readiness | ||
| let async_stream = AsyncFd::new(std_stream).context("creating AsyncFd for handshake socket")?; |
There was a problem hiding this comment.
Ensure handshake socket stays nonblocking before AsyncFd
If tokio::net::UnixStream::into_std() returns a blocking socket (Tokio’s documented behavior), AsyncFd::new(std_stream) will wrap a blocking FD and recv_with_fd can block the runtime thread if Firecracker connects but delays sending the UFFD message. In that case the 30s timeout won’t fire because the task is stuck in a blocking syscall, and enough stalled connections can exhaust Tokio worker threads. Consider explicitly setting the std stream to nonblocking (or using from_std on a nonblocking fd) before wrapping in AsyncFd.
Useful? React with 👍 / 👎.
🔍 Claude ReviewSEVERITY: none FindingsNo issues found. The changes are correct and well-implemented:
SummaryClean PR that correctly replaces blocking Review by Claude | Run |
c86543e to
8125ce6
Compare
c37e122 to
6478d40
Compare
🔍 Claude ReviewSEVERITY: none FindingsNo new issues found. Thorough analysis of the implementation confirms correctness:
As noted in previous review, no issues were found. This second review confirms the analysis with deeper verification of type compatibility and API contracts. SummaryClean, correct PR. The async handshake refactoring properly avoids blocking the tokio runtime and the per-connection task spawn with timeout is a well-designed improvement. Review by Claude | Run |
8125ce6 to
02c6c4b
Compare
39e0b69 to
edeff8a
Compare
🔍 Claude ReviewSEVERITY: none FindingsNo issues found. Two previous reviews (review 1, review 2) reached the same conclusion. This third independent review confirms correctness after verifying:
SummaryClean, correct PR. The async handshake refactoring properly avoids blocking the tokio runtime, and the per-connection task spawn with timeout is a well-designed improvement. No changes needed. Review by Claude | Run |
The UFFD server's run() loop called recv_with_fd() inline in the tokio select! loop after converting the socket to blocking mode. This serialized all clone connections and would hang the server forever if a clone misbehaved during handshake. Replace the blocking handshake with an async receive_uffd_async() that uses AsyncFd (same pattern already used for handle_vm_page_faults in the same file). Each connection is now spawned as a per-connection task with a 30s timeout, so the accept loop returns immediately. Also document why Flock::lock() in the state manager is acceptable as blocking I/O in an async context (microsecond hold time, near-zero contention).
edeff8a to
ad99d7c
Compare
🔍 Claude ReviewSEVERITY: none FindingsNo issues found. Three previous reviews (review 1, review 2, review 3) reached the same conclusion. This fourth independent review confirms correctness. The async handshake refactoring is well-implemented:
SummaryClean, correct PR. No changes needed. Review by Claude | Run |
Fix blocking I/O in UFFD server accept loop
Fix blocking I/O in UFFD server accept loop
Stacked on: review-networking (PR #283)
Summary
recv_with_fdin the tokioselect!loop with asyncreceive_uffd_async()usingAsyncFd(same pattern ashandle_vm_page_faults). Each connection spawns a per-connection task with a 30s timeout, so the accept loop is never blocked by slow/misbehaving clones.Flock::lock()is acceptable as blocking I/O (microsecond hold time, near-zero contention).Test plan