Skip to content

fix: intermittent failure in feature_dip3_v19.py - #5863

Merged
PastaPastaPasta merged 1 commit into
dashpay:developfrom
UdjinM6:fix_dip3_test
Feb 9, 2024
Merged

fix: intermittent failure in feature_dip3_v19.py#5863
PastaPastaPasta merged 1 commit into
dashpay:developfrom
UdjinM6:fix_dip3_test

Conversation

@UdjinM6

@UdjinM6 UdjinM6 commented Feb 8, 2024

Copy link
Copy Markdown

Issue being fixed or feature implemented

Fix failures like https://gitlab.com/dashpay/dash/-/jobs/6120923632

What was done?

Handle disconnects and reconnection of the revoked MN in the right place.

How Has This Been Tested?

Run multiple feature_dip3_v19.py in parallel a few times

Breaking Changes

n/a

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation
  • I have assigned this pull request to a milestone (for repository code-owners and collaborators only)

@UdjinM6 UdjinM6 added this to the 20.1 milestone Feb 8, 2024

@knst knst left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

Though, I can't reproduce failure on feature_dip3_v19.py whatever with or without your patch, with -j20 or with -j4. That successes 100% on my localhost

@ogabrielides ogabrielides left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

utACK

@PastaPastaPasta PastaPastaPasta left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

utACK for squash merge

@PastaPastaPasta
PastaPastaPasta merged commit 19681d0 into dashpay:develop Feb 9, 2024
PastaPastaPasta added a commit that referenced this pull request Aug 2, 2026
…-key change/revoke

dc27835 test: don't expect zero connections after protx operator-key change/revoke (pasta)

Pull request description:

  ## Issue being fixed or feature implemented
  Fixes the currently worst-offending functional-test flake, #6702 (`feature_protx_version.py`, formerly `feature_dip3_v19.py`). The two most recent CI occurrences (2026-07-30, one under TSAN and one under multiprocess, both exhausting all three retries) time out at the same predicate:

  ```text
  self.wait_until(lambda: self.nodes[node_idx].getconnectioncount() == 0)
  AssertionError: ... not true after 240.0 seconds
  ```

  at line 202 (operator-key change / v1→v3 migration path) and line 241 (`test_revoke_protx`).

  The root cause is a race in the test, not an implementation bug. Two correct behaviors compose into a predicate that is not guaranteed to ever be observable:

  1. Changing a masternode's operator key (or revoking it) makes every peer that verified its MNAUTH drop the connection once it processes the trigger block (`CMNAuth::NotifyMasternodeListChanged`). This part works: in every captured failure, all pre-existing peers of the affected node are disconnected within ~1 second.
  2. The masternode remains a member of previously formed quorums (membership is snapshotted at DKG time), so `CConnman::ThreadOpenMasternodeConnections` on *both* sides legitimately re-establishes intra-quorum connections on its 100 ms–1 s retry loop, and the affected node also keeps accepting inbound quorum connections. These replacement connections are not dropped again, because the node stops sending MNAUTH once its configured operator key no longer matches the list.

  Under load the replacement connections land before the teardown finishes, so `getconnectioncount()` never transiently reaches zero and the wait can only pass by timing luck. The zero-wait was itself introduced as the fix for the previous incarnation of this flake (#5863), where `connect_nodes` raced the disconnect storm — it traded one race for another.

  The other `getconnectioncount() == 0` waits in the tree (`feature_llmq_signing.py`, `feature_llmq_simplepose.py`) are not affected: they call `setnetworkactive(false)` first, which also blocks reconnections.

  ## What was done?
  Test-only change. Instead of expecting an instantaneous zero, the test now snapshots the affected node's peer ids immediately before mining the trigger transaction and waits until none of those ids remain in `getpeerinfo()`. Peer ids are monotonically increasing per node, so this deterministically detects that the key change/revocation dropped every pre-existing connection while tolerating concurrent (legitimate) quorum reconnections. Both call sites use a shared helper.

  The alternative of quiescing the network via `setnetworkactive(false)` was deliberately not used: it would drop all connections regardless of whether the ban-disconnect logic works, gutting the behavioral assertion the wait provides.

  ## How Has This Been Tested?
  Reproduced and verified on macOS (M-series, 14 cores) at develop `a61ade2ef84` with 15 concurrent copies of the test:

  ```bash
  python3 test/functional/test_runner.py --jobs=15 --attempts=1 $(for _ in $(seq 15); do echo feature_protx_version.py; done)
  ```

  - Before the change: 6/15, 5/15 and 9/15 runs failed across three batches — every single failure at the line 202/241 zero-wait (no unrelated contention failures).
  - After the change: 45/45 runs passed (three batches of 15).
  - Re-checked out the pre-fix state afterwards and re-ran one batch: 9/15 failures returned, all matching the signature.
  - The 60 s local timeout vs. 240 s in CI is `TEST_RUNNER_TIMEOUT_FACTOR=4` (`ci/test/00_setup_env.sh`); same predicate, same bug.
  - Sequential run of the fixed test passes in ~150 s, matching CI's passing runtime.

  ## Breaking Changes
  n/a

  ## Checklist:
  - [x] I have performed a self-review of my own code
  - [x] I have commented my code, particularly in hard-to-understand areas
  - [x] I have added or updated relevant unit/integration/functional/e2e tests
  - [ ] I have made corresponding changes to the documentation
  - [ ] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_

  🤖 Generated with [Claude Code](https://claude.com/claude-code)

Top commit has no ACKs.

Tree-SHA512: 7c740ddeb2541741cf858cfd0094809ea64ddca4f150bb2f08a75fc59df475c56f20eb039649d508d3d86517bb7c2834c8cafe927e7c6cd4b669c5f9874bdff5
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.

4 participants