Review report

bitcoin/bitcoin: PR #36259

1 suggestion

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

Optional improvements

Link

[suggestion] · The race regression test can miss its triggering interleaving

If the second worker is delayed beyond the 200 ms window, the test can pass with the original bug restored despite describing the reproduction as deterministic.

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

Details and suggested fix

In phase 2, RaceSock::Send() signals io_thread_in_send and sleeps for 200 ms while holding m_send_mutex, but receives no acknowledgement that the worker reached HTTPRemoteClient::Send(). With the fix reverted, a worker delayed until after reply 0 drains lets the I/O thread observe m_keep_alive == true and retain the connection. The worker can then clear the flag and enqueue reply 1; phase-3 EAGAIN holds that reply without disconnecting, so all subsequent assertions can pass. The generous sleep makes this require substantial scheduler delay, but it does not guarantee the claimed ordering. To make the test deterministic, add a narrowly scoped test-only signal after header serialization and immediately before LOCK(m_send_mutex), and have the mock wait for that signal from the reply-1 call with a bounded timeout that fails the test. In the original implementation the unlocked store would already have executed; with the fix it would remain blocked behind the mutex. Signalling before WriteReply() would still leave the relevant store unordered. This approach costs a hook in the production send path; if that cost is unwanted, retain the sleep but describe the reproduction as timing-based and best effort.


Coverage details

Earlier concerns

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