Skip to content

Fix intermittent failure in t/modules/sed.t - #23

Merged
notroj merged 1 commit into
apache:trunkfrom
notroj:sed-flaky-test
Aug 29, 2026
Merged

notroj merged 1 commit into
apache:trunkfrom
notroj:sed-flaky-test

Conversation

@notroj

@notroj notroj commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

t/modules/sed.t test 3 fails intermittently. Seen on an httpd CI run
(job),
where the harness's own -v re-run of the same file then passed, as did the
same job on the next push.

The case POSTs 24 MiB through mod_echo_post with an OutputSed which grows
each line. mod_sed gives up with APR_ENOMEM once the substituted line
exceeds MAX_BUF_SIZE, logging AH10394 2048 times in both the passing and
the failing run. What differs is where the last socket read lands:

  • Passing: every read is exactly 8192 bytes, so each ap_rwrite() exceeds the
    free space in the ap_old_write buffer and flushes inline. Nothing is left
    at EOS, sed's EOS branch succeeds, and a 200 goes out.
  • Failing: one short read means the final write is small enough to sit in the
    buffer, so it is flushed together with the EOS. sed_response_filter() fails
    on that brigade and breaks without calling ap_pass_brigade(), so the EOS
    is dropped and the header filters never run. No response bytes are written at
    all, and the client sees a clean EOF.

So the test asserts a status code for a case whose outcome depends on TCP read
boundaries. This accepts either, while still rejecting the 400 that the
neighbouring commented-out case mentions. There is precedent in this file:
c20d4f3 disabled a sibling entry for the same class of flakiness.

Not fixed here, and worth a look separately: sed_response_filter() dropping
the EOS means a request can end with no response whatsoever, rather than a
truncated 200 or a 500. That is httpd's modules/filters/mod_sed.c.

Note: I could not run this test locally to confirm, as
LWP::Protocol::AnyEvent::http is not available here and the whole file skips
without it. The change is syntax-checked, and t_is_equal() does support a
Regexp as the expected value.

🤖 Generated with Claude Code

  case.  mod_sed fails with ENOMEM once the substituted line grows past
  MAX_BUF_SIZE, and whether a 200 was sent first depends on where the
  last socket read lands, so the test failed intermittently.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@notroj
notroj merged commit 4c187f2 into apache:trunk Aug 29, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant