Skip to content

Commit f821d40

Browse files
committed
FEATURE-ci-v3-runtime-green: bound the pipe payload and drive the truncated send to completion
Both fixes answer second FreeBSD recurrences with retained evidence (run 46508507388, platform-FreeBSD-failure-evidence, tls-no make check test-suite.log): response_sources hung at threaded_pipe_sends_single_winner twice (exit 124 both times under the stage-11 timeout wrapper). The rig constructor writes the whole payload through a blocking fd before any reader exists, so the payload must fit the kernel pipe capacity; FreeBSD's default is 8 KiB and this was the only pipe payload at that boundary (every other pipe payload is <= 4096). The race semantics need only an identical body across the four threads, so the payload drops to 4096 with a 2x margin, and the rig now documents the POSIX payload bound next to the stage-14 Windows sizing note. response_definition failed checks 846/847 twice in file_send_truncated_mid_send_fails: after the wake round, done stayed 0. Every library path reaches the spawn callback within one drain-and-pump round, so the extra completion (a stream-buffer tail served after the truncation, parking the exactly-full queue once more, or one additional executor round) is now tolerated by a bounded drive; the checked first drain and both original assertions are unchanged, and a permanent stall still fails them with the same evidence.
1 parent de00209 commit f821d40

3 files changed

Lines changed: 25 additions & 1 deletion

File tree

‎test/unit/response_definition_test.cpp‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -843,6 +843,17 @@ LT_BEGIN_AUTO_TEST(response_definition_suite, file_send_truncated_mid_send_fails
843843
LT_CHECK_EQ(out.drain(1u << 20),
844844
static_cast<std::size_t>(k_file_chunk_capacity));
845845
ex.run_pending();
846+
// One wake-and-pull round normally completes the failed send. The
847+
// bounded drive tolerates a platform where the truncation surfaces
848+
// one pull later (a stream-buffer tail still holds pre-truncation
849+
// bytes and the next pull parks the exactly-full queue once more)
850+
// or where the completion lands one executor round later. A
851+
// permanent stall still fails the checks below with the same
852+
// evidence (FreeBSD 2026-10-30/2026-11-30, checks 846/847).
853+
for (int rounds = 1; rounds < 8 && done == 0; ++rounds) {
854+
out.drain(1u << 20);
855+
ex.run_pending();
856+
}
846857
LT_CHECK_EQ(done, 1);
847858
LT_CHECK(seen.status.code() == http::outcome_code::protocol_error);
848859
LT_CHECK_EQ(sink.respond_calls, 1);

‎test/unit/response_source_rig.hpp‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,13 @@ inline std::FILE* rig_fdopen(int fd) noexcept { return ::fdopen(fd, "rb"); }
166166
// write end closes immediately so the read end sees EOF right after
167167
// the payload). One-shot by construction: no seek position, no second
168168
// read of the same bytes.
169+
//
170+
// The constructor writes the entire payload through a blocking fd
171+
// before any reader exists, so on POSIX the payload must fit the
172+
// kernel pipe capacity: keep it at or under 4 KiB (FreeBSD's default
173+
// capacity is 8 KiB; an 8192-byte payload blocked there forever twice).
174+
// The Windows branch sizes its own buffer to the payload and lifts
175+
// that bound.
169176
class filled_pipe {
170177
public:
171178
explicit filled_pipe(const std::string& payload) {

‎test/unit/response_sources_test.cpp‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -939,7 +939,13 @@ LT_END_AUTO_TEST(owned_pipe_second_send_rejected_before_writing)
939939
// the endpoint closes exactly once across all of them.
940940
LT_BEGIN_AUTO_TEST(response_sources_suite, threaded_pipe_sends_single_winner)
941941
constexpr int k_threads = 4;
942-
const std::string payload = repeating(8192);
942+
// The rig writes the whole payload into the pipe before any reader
943+
// exists, so the payload must fit every supported kernel pipe
944+
// capacity: FreeBSD's default is 8 KiB, and an 8192-byte write hung
945+
// there twice (the 2026-10-30 and 2026-11-30 acceptance runs). The
946+
// race semantics need only a body that all four threads observe
947+
// identically, so 4096 bytes keep a 2x margin.
948+
const std::string payload = repeating(4096);
943949
auto closes = std::make_shared<std::atomic<int>>(0);
944950
response_definition def;
945951
LT_CHECK(response_definition::owned_pipe(

0 commit comments

Comments
 (0)