Skip to content

Fix flaky SnapServerTest.assertAccountLimitRangeResponse#10189

Merged
daniellehrner merged 4 commits intobesu-eth:mainfrom
daniellehrner:fix/flaky_test_snap_server
Apr 7, 2026
Merged

Fix flaky SnapServerTest.assertAccountLimitRangeResponse#10189
daniellehrner merged 4 commits intobesu-eth:mainfrom
daniellehrner:fix/flaky_test_snap_server

Conversation

@daniellehrner
Copy link
Copy Markdown
Contributor

PR description

SnapServerTestassertAccountLimitRangeResponse is flaky (especially in ARCHIVE mode) because ResponseSizePredicate has a hard-coded 4 second time limit that could fire before the byte-size limit on slow/loaded machines, returning fewer accounts than expected. To fix that this PR makes the time limit configurable via a new @VisibleForTesting constructor on SnapServer, so the test can effectively disable it by setting it to Long.MAX_VALUE.

Fixed Issue(s)

Thanks for sending a pull request! Have you done the following?

  • Checked out our contribution guidelines?
  • Considered documentation and added the doc-change-required label to this PR if updates are required.
  • Considered the changelog and included an update if required.
  • For database changes (e.g. KeyValueSegmentIdentifier) considered compatibility and performed forwards and backwards compatibility tests

Locally, you can run these tests to catch failures early:

  • spotless: ./gradlew spotlessApply
  • unit tests: ./gradlew build
  • acceptance tests: ./gradlew acceptanceTest
  • integration tests: ./gradlew integrationTest
  • reference tests: ./gradlew ethereum:referenceTests:referenceTests
  • hive tests: Engine or other RPCs modified?

Signed-off-by: daniellehrner <daniel.lehrner@consensys.net>
Signed-off-by: daniellehrner <daniel.lehrner@consensys.net>
Copilot AI review requested due to automatic review settings April 6, 2026 09:46
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Makes SnapServer’s per-request time limit configurable (for tests) to eliminate flakiness in SnapServerTest.assertAccountLimitRangeResponse, especially on slower/loaded machines.

Changes:

  • Add a maxMillisPerRequest field and thread it through snap response size/time limiting logic.
  • Introduce a @VisibleForTesting SnapServer constructor to override the default time limit.
  • Update SnapServerTest to effectively disable the time limit by passing Long.MAX_VALUE.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/manager/snap/SnapServerTest.java Uses the new testing constructor to avoid time-based truncation in the flaky test.
ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/snap/SnapServer.java Makes the max per-request time configurable and replaces the previous hard-coded 4s limit usage.

Copy link
Copy Markdown
Contributor

@garyschulte garyschulte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM. Copilot did find a pre-existing duplicate SnapServer.start() call that we can clean up in this PR, but changes LGTM.

@daniellehrner daniellehrner enabled auto-merge (squash) April 7, 2026 07:50
@daniellehrner daniellehrner merged commit b1af1fe into besu-eth:main Apr 7, 2026
37 of 54 checks passed
@daniellehrner daniellehrner deleted the fix/flaky_test_snap_server branch April 7, 2026 09:17
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.

3 participants