Skip to content

flaky(test): node_origin_pull::node_origin_not_found_refusal_does_not_tar_upstream fails ~50% since #2248 #2268

Closed

Description

@yigitdot

Symptom

node_origin_pull::node_origin_not_found_refusal_does_not_tar_upstream fails about half the time. It fails at the first counter assert:

Error: expected metric line `decdn_node_pull_refused_total 1`; got: ... decdn_node_pull_refused_total 0

In the failing runs, node_pull_attempts_total is 1 and node_pull_success_total is 1. B pulls from A on the first attempt and never tries N, the refusing candidate. Nextest retries usually hide the failure, which shows up as 1 flaky in the summary.

Repro (macOS, 14 cores)

cargo nextest run -p decdn-node capacity_bond_registry node_origin --retries 0 --no-fail-fast

Failure rate over repeated runs of that command:

Commit Failures
e13878fe (before #2248) 1/10
4fd9b701 (#2248) 6/10
main @ cb83e28b 6/10

Likely cause

The test relies on N ranking first because N quotes STALL_RATE = RATE / 2. But selection::compute_score is rate * rtt / rep², and node_origin::ms_to_u32 truncates the probe RTT to whole milliseconds. #2248 times the probe RTT on the already-open connection, so it no longer includes the dial. On loopback that RTT is often under 1 ms, so both candidates get rtt_ms = 0, both score 0, and the random tier of the ADR 008 tie-breaker picks the order. When A ranks first, it delivers and N is never tried.

The rate-based ordering assumption also appears in other loopback tests in crates/node/tests/node_origin_pull.rs (for example, the staller near L2517: "quotes the cheaper STALL_RATE so it ranks ahead of A"). Those tests may be exposed to the same tie.

Possible fixes

  • Test side: make the ordering deterministic without relying on RTT. For example, pin the candidate order or give the stub a fixed RTT.
  • Product side: a 0 ms RTT erases the price signal entirely, so a sub-millisecond RTT turns ranking into a coin flip on rate. Consider a floor of 1 ms in ms_to_u32 for the score, or keep sub-ms precision in compute_score. This is a ranking change (ADR 008), so it needs a decision, not just a test fix.

Found while running the gate for #2259; that PR changes only log formatting and does not affect this test.

Activity

  1. added
    kind:bug
    rust
    kind:test
    area:node
    prio:medium
    on Oct 1, 2026
  2. thiras commented on Oct 5, 2026

    @thiras
    Contributor

    More sightings on Linux x86_64 (16 cores), --retries 0. They include a second test that relies on the same ranking assumption.

    node_origin_not_found_refusal_does_not_tar_upstream fails with the same decdn_node_pull_refused_total 1 assert:

    • main @ b37bbc4a, full -p decdn-node, sequential: 1/6
    • branch (an unrelated cache-crate change), -E 'binary(node_origin_pull)': 1/25

    a_probe_cache_hit_still_honours_the_negative_cache fails with:

    Error: N must be pulled exactly once, got 0
    
    • branch, full suite, sequential: 1/6
    • branch, binary(origin_range_pull) | binary(node_origin_pull): 1/15
    • branch, full suite under concurrent load: 1/8
    • branch, binary(node_origin_pull): 1/25

    This test makes the same assumption: N is "quoting a cheaper rate so it ranks #1 and is always tried first" (STALL_RATE). got 0 means A ranked first and N was never asked. That matches the sub-millisecond RTT tie described above, so the test fix (or the ms_to_u32 floor decision) should cover it too.

    (binary(node_origin_pull) on main: 0/25 in the same session. The rate is low enough that 25 runs doesn't separate the two trees, and neither tree touches this ranking path.)

  3. self-assigned this
    on Oct 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:nodekind:bugkind:testprio:mediumrust

Type

No type

Fields

Priority

None yet

Projects

  • Status
    Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions