Skip to content

[2.4.x] Merge test_h2_008_04 server-status race fix from trunk - #720

Merged
notroj merged 1 commit into
apache:2.4.xfrom
notroj:24x-h2-ranges-settle
Nov 28, 2026
Merged

notroj merged 1 commit into
apache:2.4.xfrom
notroj:24x-h2-ranges-settle

Conversation

@notroj

@notroj notroj commented Aug 28, 2026 •

Copy link
Copy Markdown
Collaborator

Backport of #1109 (15c6e22), replacing the earlier version of this fix. As well as polling /status?auto until Total Accesses settles, the Total kBytes upper bound now allows for the body size of every extra status response, the problem @arturobernalg found here.

🤖 Generated with Claude Code

@arturobernalg

arturobernalg commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

Thanks @notroj . The polling fixes the access count, but the retry path then fails the kBytes check: each extra /status?auto poll adds about 1.8 kB to Total kBytes, and the upper bound doesn't account for it.

I reproduced the race locally on 2.4.x by delaying ap_increment_counts() by 500 ms for one stream in eor_bucket_cleanup(). Over 5 runs each:

  • Original test: failed 5/5 (41 <= 39, stream not yet counted).
  • This PR: failed 5/5. The retry worked (7 status requests), but the kBytes assertion failed (45 > 52).
  • Accounting for the extra polls: passed 5/5, with and without the delay.

The change I tested:

polled_kb = 0
for _ in range(10):
    stats = self.get_server_status(env)
    accesses = int(stats['Total Accesses'])
    if accesses >= expected:
        break
    expected += 1
    polled_kb += (stats['_bytes'] + 1023) // 1024 + 1
    time.sleep(0.1)
...
# Upper bound
assert (4*(count+1))+1 + polled_kb > int(stats['Total kBytes']), f'{stats}'

With stats['_bytes'] = len(r.stdout) in get_server_status().

This also passed with 0–9 forced extra polls locally. The additional 1 kB is an allowance for headers rather than an exact measurement, so there may be a better way to account for the polling traffic.

Trunk has the same test, so it may be worth fixing there first.

  Poll server-status until the access count settles, allowing for
  the polls themselves in the expected totals.
  (TestRanges.get_server_status): Record the response body length.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
(cherry picked from commit 15c6e22)
@notroj
notroj force-pushed the 24x-h2-ranges-settle branch from b47405d to 9453189 Compare November 28, 2026 11:51
@notroj notroj changed the title 2.4.x: try to fix flapping h2 test in test_008_04 server-status check [2.4.x] Merge test_h2_008_04 server-status race fix from trunk Nov 28, 2026
@notroj
notroj merged commit 39437ea into apache:2.4.x Nov 28, 2026
36 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.

2 participants