Skip to content

fix: deflake //rs/tests/node:ipv4_integration_test by stopping ic-replica before the crypto vault - #11874

Merged
basvandijk merged 2 commits into
masterfrom
bas/deflake-ipv4-integration-test
Oct 16, 2026
Merged

basvandijk merged 2 commits into
masterfrom
bas/deflake-ipv4-integration-test

Conversation

@basvandijk

Copy link
Copy Markdown
Collaborator

ipv4_integration_test_head_nns_local flaked on #11744 after removing its unassigned node and letting it register itself again: the registry stayed at version 3 until the 180 s timeout. The cause is a race in the test's re-registration script that already exists on master:

  1. The script stopped ic-crypto-csp (the crypto vault) before ic-replica (the orchestrator). The vault is socket-activated, and the orchestrator's vault client reconnects about 100 ms after losing its connection. If the orchestrator is still alive at that point, the reconnect starts a new vault, which can read the old public_keys.pb and sks_data.pb before the script deletes them.
  2. The node then comes back with its old keys and node ID. The orchestrator checks its registration only once at startup, against a local registry copy that predates the removal. The check passes silently, so the node never registers again.

On master the vault was started again this way in 4 of 223 _local attempts (2026-10-02..16). A failure also needs the new vault to read the key files before the rm. The same timeout failed 4 Farm runs in Jan–Mar 2026.

The fix changes both scripts that use this pattern: ipv4_integration_test and node_registration_test_common, which the two node registration tests share.

  • Stop ic-replica first, then ic-crypto-csp.socket together with ic-crypto-csp.service. No vault client is left to reconnect, and the closed socket cannot start the vault before the keys are deleted. Start the socket and the service again afterwards.
  • Assert that the node registered with a new node ID. This catches a node re-registering under its old ID, where the test would otherwise pass. That happened once on master in node_registration_with_node_allowance_test_local.

Verification, with local _local runs:

  • Master's script with sleep 0.3 between the two stops, which forces the reconnect, failed 2 of 2 runs with the flake's signature: the old node ID and a timeout at registry version 3.
  • With this change, ipv4_integration_test_local, ipv4_integration_test_head_nns_local, node_registration_with_node_allowance_test_local and node_registration_with_max_rewardable_nodes_test_local passed, and each node registered with a new ID.

Labelled CI_ALL_BAZEL_TARGETS so that CI runs these system tests: ipv4_integration_test is a long_test.

🤖 Generated with Claude Code

…lica before the crypto vault

The node re-registration scripts stopped ic-crypto-csp before ic-replica.
The orchestrator's vault client then reconnected about 100 ms later and
socket-activated a new vault, which could load the old key files before
they were deleted. The node came back with its old node ID, its one-time
registration check passed against a stale local registry, and the test
timed out waiting for registry version 4.

Stop ic-replica first, then the vault's socket and service, and assert
that the node registers with a new node ID.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@basvandijk basvandijk added the CI_ALL_BAZEL_TARGETS Runs all bazel targets label Oct 16, 2026
@github-actions github-actions Bot added the fix label Oct 16, 2026
Co-Authored-By: Claude Opus 5.5 <[email protected]>

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.

🟢 Approval recommended

The focused changes address the restart race and strengthen registration checks, with no unresolved findings.

0 open findings

What changed in this PR

Fixes a node re-registration race in system tests by preventing the crypto vault from restarting with old keys.

Changes:

  • Stop ic-replica before stopping the vault socket and service.
  • Restart the vault after deleting keys.
  • Assert that re-registration produces a new node ID.
File Description
rs/​tests/​node/​ipv4_integration_test.rs Corrects shutdown order and checks the new node ID.
rs/​tests/​consensus/​node_registration_test_common/​src/​lib.rs Applies the same safeguards to shared node-registration tests.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@basvandijk
basvandijk marked this pull request as ready for review October 16, 2026 12:44
@basvandijk
basvandijk requested review from a team as code owners October 16, 2026 12:44

@pierugo-dfinity pierugo-dfinity 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.

Sounds good thanks

@basvandijk
basvandijk enabled auto-merge October 16, 2026 12:56
@basvandijk
basvandijk added this pull request to the merge queue Oct 16, 2026
Merged via the queue into master with commit ef2369f Oct 16, 2026
45 of 46 checks passed
@basvandijk
basvandijk deleted the bas/deflake-ipv4-integration-test branch October 16, 2026 21:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants