Skip to content

Fix timing race in BackpressureTimeout_must_succeed_if_subscriber_demand_arrives test#7972

Merged
Aaronontheweb merged 1 commit into
akkadotnet:devfrom
Aaronontheweb:claude-wt-BackpressureTimeout_must_succeed_if_subscriber_demand_arrives-fix
Dec 22, 2025
Merged

Fix timing race in BackpressureTimeout_must_succeed_if_subscriber_demand_arrives test#7972
Aaronontheweb merged 1 commit into
akkadotnet:devfrom
Aaronontheweb:claude-wt-BackpressureTimeout_must_succeed_if_subscriber_demand_arrives-fix

Conversation

@Aaronontheweb
Copy link
Copy Markdown
Member

Summary

Fixed an intermittent test failure in BackpressureTimeout_must_succeed_if_subscriber_demand_arrives that was occurring in CI/CD environments due to timing race conditions.

Root Cause

The test was experiencing a timing race where accumulated delays exceeded the backpressure timeout threshold:

  • Original timeout: 1 second
  • Accumulated delays: 3 iterations × 250ms = 750ms
  • Safety margin: Only 250ms

In CI/CD environments with thread pool contention, async/await overhead, and timer imprecision, this insufficient margin caused the timeout to trigger before demand was registered, resulting in:

Expected OnNext(int), but received OnError("No demand signalled in the last 00:00:01.")

Changes

  • Increased BackpressureTimeout from 1 second to 2 seconds
  • Reduced ExpectNoMsg delays from 250ms to 100ms per iteration

Result

  • New timeout: 2000ms
  • New accumulated delays: 3 × 100ms = 300ms
  • New safety margin: 1700ms (5.7× improvement)

This provides adequate buffer for:

  • Async/await scheduling overhead
  • Test infrastructure processing delays
  • CI/CD thread pool contention and resource constraints
  • Timer check granularity (250ms intervals for 2-second timeout)

Testing

✅ Test passes reliably with the new timing parameters
✅ Test semantics unchanged - still verifies demand arriving within timeout prevents backpressure errors

Related

Addresses racy test failures similar to other timeout tests in the same file that are marked as LocalFact.

…and_arrives test

The test was failing intermittently in CI/CD with "No demand signalled in the last 00:00:01" because accumulated delays (750ms) left insufficient safety margin with the 1-second timeout.

Changes:
- Increased backpressure timeout from 1s to 2s
- Reduced ExpectNoMsg delays from 250ms to 100ms per iteration

This provides 1700ms safety margin (vs 250ms previously) to handle:
- Async/await scheduling overhead
- Thread pool contention in CI/CD environments
- Timer check granularity and imprecision
- Test infrastructure processing delays

The test semantics remain unchanged - it still verifies that demand arriving within the timeout window prevents backpressure timeout errors.
@Aaronontheweb
Copy link
Copy Markdown
Member Author

This is, unfortunately, a timing-sensitive test and timeout jiggling is probably the best solution here

@Aaronontheweb Aaronontheweb merged commit ca86923 into akkadotnet:dev Dec 22, 2025
11 checks passed
Arkatufus pushed a commit to Arkatufus/akka.net that referenced this pull request Jan 7, 2026
…and_arrives test (akkadotnet#7972)

The test was failing intermittently in CI/CD with "No demand signalled in the last 00:00:01" because accumulated delays (750ms) left insufficient safety margin with the 1-second timeout.

Changes:
- Increased backpressure timeout from 1s to 2s
- Reduced ExpectNoMsg delays from 250ms to 100ms per iteration

This provides 1700ms safety margin (vs 250ms previously) to handle:
- Async/await scheduling overhead
- Thread pool contention in CI/CD environments
- Timer check granularity and imprecision
- Test infrastructure processing delays

The test semantics remain unchanged - it still verifies that demand arriving within the timeout window prevents backpressure timeout errors.
Aaronontheweb added a commit that referenced this pull request Jan 8, 2026
…and_arrives test (#7972)

The test was failing intermittently in CI/CD with "No demand signalled in the last 00:00:01" because accumulated delays (750ms) left insufficient safety margin with the 1-second timeout.

Changes:
- Increased backpressure timeout from 1s to 2s
- Reduced ExpectNoMsg delays from 250ms to 100ms per iteration

This provides 1700ms safety margin (vs 250ms previously) to handle:
- Async/await scheduling overhead
- Thread pool contention in CI/CD environments
- Timer check granularity and imprecision
- Test infrastructure processing delays

The test semantics remain unchanged - it still verifies that demand arriving within the timeout window prevents backpressure timeout errors.
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.

1 participant