Skip to content

[codex] Resolve flaky race in check_channels missing actor test#1435

Open
jjyr wants to merge 1 commit into
nervosnetwork:developfrom
jjyr:fix/check-channels-missing-actor-flake
Open

[codex] Resolve flaky race in check_channels missing actor test#1435
jjyr wants to merge 1 commit into
nervosnetwork:developfrom
jjyr:fix/check-channels-missing-actor-flake

Conversation

@jjyr

@jjyr jjyr commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator

Summary

Resolves a flaky race in test_check_channels_does_not_fallback_when_channel_actor_missing.

Root Cause

The test injected an expired TLC into a live channel actor via update_channel_actor_state immediately before stopping it. Each channel actor runs periodic MaintainChannelTlcs every CHECK_CHANNELS_INTERVAL (3s in debug builds), which detects and removes expired received TLCs. When the interval ticked during the test sleep window, the actor sent a peer RemoveTlc before it was stopped, moving the offered TLC on node A from Committed to RemoveWaitAck and failing the assertion.

Fix

Swap the sequence: stop the channel actor before writing the expired TLC into persisted state. Removes the race window entirely.

Validation

  • cargo fmt --all -- --check
  • git diff --check
  • cargo nextest run -p fnn --features rocksdb test_check_channels_does_not_fallback_when_channel_actor_missing
  • Repeated 10 times with hot cache: 10/10 passed

@jjyr jjyr marked this pull request as ready for review June 10, 2026 11:47
@jjyr jjyr requested a review from quake June 10, 2026 12:01
@jjyr jjyr force-pushed the fix/check-channels-missing-actor-flake branch from a258bda to 587420e Compare June 11, 2026 04:29
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