Review report

core: PR #36259

1 suggestion

Earlier concerns neither republished nor resolved: 1 suggestion. See the Run archive for their assessments.

Optional improvements

Link

[suggestion] · Fixed sleep lets the race regression test miss the old bug

If the second worker resumes only after the first response drains, the unfixed implementation can pass every assertion, so the test does not deterministically reproduce the race.

Location: src/test/httpserver_tests.cpp:1120 (head).

Details and suggested fix

In phase 2, RaceSock::Send() sets io_thread_in_send, sleeps 200 ms, and flushes reply 0 without confirming that the worker reached HTTPRemoteClient::Send(). If the worker remains descheduled through that flush and the keep-alive check, the base implementation still has m_keep_alive == true and leaves the connection open. The worker can then queue reply 1, which phase 3 holds until allow_second_reply is set. Delivery and disconnection subsequently satisfy the remaining assertions. Neither the single worker nor the later 500 ms delay establishes the missing ordering. To make the reproduction deterministic, add a test-only acknowledgement immediately before acquiring m_send_mutex in Send(), after the former unlocked assignment site, and have the mock wait for it with a bounded timeout that fails the test. The worker can signal there without acquiring the mutex held by the mock's caller. This costs a test hook in the production send path; if retaining the timing-based approach instead, describe it as such rather than deterministic.


Coverage details

Earlier concerns

Earlier reports raised these, with the titles and severities shown there. This review neither republished nor resolved them.