Skip to content

Fix flaky tests - #5482

Merged
graydon merged 3 commits into
stellar:masterfrom
graydon:fix-flaky-flow-control-bypass
Oct 13, 2026
Merged

graydon merged 3 commits into
stellar:masterfrom
graydon:fix-flaky-flow-control-bypass

Conversation

@graydon

@graydon graydon commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

We've had a flaky overlay test breaking CI runs for a while now (most recently https://github.com/stellar/stellar-core/actions/runs/37384282444/job/112013606376?pr=5479 in #5479). The root cause is a test helper that's used in a bunch of places that tries to bypass outbound flow control -- basically to emulate a misbehaving peer sending stuff they shouldn't send -- but doesn't necessarily maintain invariants expected by the flow control subsystem. As a result, one recently-added test has a nondeterministic/racy break of one of the invariants, so the test aborts with an assert failure from time to time.

This change renames the test helper method to clarify what it's supposed to be doing, and then modifies what it does to explicitly mark (in test-only code) outgoing messages that are supposed to bypass flow control and then .. just bypasses the flow control including the book-keeping code that has invariants to maintain.

At least, this is what sol-and-I discussed and implemented. I am fairly convinced it's correct. It also does seem to get rid of the failure (I ran the test in a loop, crashes before, no more crashes after). But I wouldn't mind careful and conceptual review!

I also included here a new, different workaround for the bug I tried but failed to fix in #5462 -- config.status getting stuck reconfiguring with unknown arguments accidentally promoted from gperftools. The previous fix didn't work, but hopefully this one does!

I also included a fix for another flaky test, "ledger state update flow with parallel apply", which has been periodically failing with a simulation timeout.

Copilot AI balanced review requested due to automatic review settings October 8, 2026 08:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Synthetic loopback duplicates can still perform flow-control completion bookkeeping twice and trigger an assertion.

1 open finding
What changed in this PR

Makes test-only flow-control bypass explicit, preventing flaky bookkeeping assertions.

Changes:

  • Renames and propagates the bypass helper and flag.
  • Skips outbound flow-control bookkeeping for bypassed messages.
  • Updates overlay tests and adds a queue-state regression assertion.
File Description
src/​overlay/​test/​TCPPeerTests.cpp Uses the explicit bypass helper.
src/​overlay/​test/​OverlayTests.cpp Updates tests and verifies queue bypass.
src/​overlay/​test/​OverlayManagerTests.cpp Updates the peer stub interface.
src/​overlay/​test/​LoopbackPeer.h Extends the loopback transport interface.
src/​overlay/​test/​LoopbackPeer.cpp Propagates bypass state and skips bookkeeping.
src/​overlay/​TCPPeer.h Extends the TCP transport interface.
src/​overlay/​TCPPeer.cpp Tracks bypass state through asynchronous writes.
src/​overlay/​Peer.h Adds test-only bypass state and API.
src/​overlay/​Peer.cpp Implements the renamed bypass helper.

🧠 Review effort: Balanced


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

Comment thread src/overlay/test/LoopbackPeer.cpp Resolved
@graydon
graydon force-pushed the fix-flaky-flow-control-bypass branch from da7ae65 to 7d80a74 Compare October 8, 2026 18:42
Copilot AI balanced review requested due to automatic review settings October 8, 2026 18:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The unrelated production build-system migration should be removed or split into a separately documented and validated change.

1 open finding
1 resolved since last review

🧠 Review effort: Balanced

Comment thread configure.ac Resolved
Copilot AI balanced review requested due to automatic review settings October 9, 2026 09:06
@graydon graydon changed the title Fix flaky test by making test-only flow control-bypass explicit Fix flaky tests Oct 9, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The new ledger-apply polling performs an unsynchronized cross-thread read while ApplyState may be committing.

1 open finding
1 resolved since last review

🧠 Review effort: Balanced

Comment thread src/herder/test/HerderTests.cpp Resolved
Copilot AI balanced review requested due to automatic review settings October 9, 2026 23:47
@graydon
graydon force-pushed the fix-flaky-flow-control-bypass branch from 3103ec7 to 07eb227 Compare October 9, 2026 23:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The aggregate ledger-completion predicate can skip its target or succeed before every node completes the intended ledger.

1 open finding
1 resolved since last review

🧠 Review effort: Balanced

Comment thread src/herder/test/HerderTests.cpp Resolved
Comment thread configure.ac Resolved
Copilot AI balanced review requested due to automatic review settings October 10, 2026 02:33
@graydon
graydon force-pushed the fix-flaky-flow-control-bypass branch from 07eb227 to 104b92d Compare October 10, 2026 02:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The updated-state test can still fail when the apply root advances beyond the published LCL.

1 open finding
1 resolved since last review

🧠 Review effort: Balanced

Comment thread src/herder/test/HerderTests.cpp Resolved
Copilot AI balanced review requested due to automatic review settings October 10, 2026 04:31
@graydon
graydon force-pushed the fix-flaky-flow-control-bypass branch from 104b92d to 20606d7 Compare October 10, 2026 04:31

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

It combines concurrency-sensitive test infrastructure with low-level Autoconf recursion changes requiring final human validation.

0 open findings

1 resolved since last review

🧠 Review effort: Balanced

@graydon
graydon added this pull request to the merge queue Oct 13, 2026
Merged via the queue into stellar:master with commit 66defff Oct 13, 2026
54 of 56 checks passed
@graydon
graydon deleted the fix-flaky-flow-control-bypass branch October 13, 2026 19:04
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