Skip to content

test: await raceToStream subscriptions before cleanup - #8354

Merged
akarnokd merged 1 commit into
ReactiveX:4.xfrom
2748109647:codex/rxjava-8340-subscriber-executor-lifecycle
Nov 16, 2026
Merged

akarnokd merged 1 commit into
ReactiveX:4.xfrom
2748109647:codex/rxjava-8340-subscriber-executor-lifecycle

Conversation

@2748109647

@2748109647 2748109647 commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Why

raceToStream() cancels both subscribers after they attach, while its default subscribe overload owns an executor that the test cannot join. StreamableBaseTest.afterTest() eagerly runs the Cleaner callbacks recorded for CompletionStageDisposable. A subscribe task still completing when that cleanup runs can therefore report the undelivered CompletionStageDisposable was not awaited or ignored explicitly error from #8340.

Change

Use a test-owned virtual-thread executor for both subscribers. Cancel both subscribers in finally, then close the executor before the test method returns so its asynchronous subscribe tasks finish before afterTest() inspects tracked stages. Keep the existing attachment and cancellation assertions.

Fixes #8340

Validation

  • .\gradlew.bat cleanTest test --tests 'io.reactivex.rxjava4.internal.operators.streamable.DispatchStreamProcessorTest.raceToStream' --no-daemon - BUILD SUCCESS on Windows with Temurin JDK 26.0.2.1.
  • .\gradlew.bat cleanTest test --tests 'io.reactivex.rxjava4.internal.operators.streamable.DispatchStreamProcessorTest' --no-daemon - BUILD SUCCESS on Windows with Temurin JDK 26.0.2.1.
  • git diff --check - passed.
  • The reported failure was not reproduced locally; the unmodified baseline passed 10 Windows runs. Linux validation was unavailable locally and remains for CI.

AI-assisted: this contribution was prepared with AI assistance and reviewed against the repository code and tests.

@github-actions

Copy link
Copy Markdown

🐷 TruffleHog + Entropy Beauty Scan

Average entropy of changed code: 4.622 bits/char
Verdict: ✅ Mid-4 beauty detected (thoughtful human code!)

Changed files entropy:

src/test/java/io/reactivex/rxjava4/internal/operators/streamable/DispatchStreamProcessorTest.java: 4.622

✅ No secrets or suspicious high-entropy strings found.

Mid-4 beauty heuristic in action — powered by our entropy chats! 😊

@codecov

codecov Bot commented Nov 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.62%. Comparing base (e97aa58) to head (6e579eb).

Additional details and impacted files
@@            Coverage Diff            @@
##                4.x    #8354   +/-   ##
=========================================
  Coverage     98.62%   98.62%           
+ Complexity     7170     7169    -1     
=========================================
  Files           826      826           
  Lines         50972    50972           
  Branches       6944     6944           
=========================================
  Hits          50269    50269           
+ Misses          479      476    -3     
- Partials        224      227    +3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@akarnokd
akarnokd merged commit dc9c2a4 into ReactiveX:4.x Nov 16, 2026
7 of 8 checks passed
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.

DispatchStreamProcessorTest > raceToStream() FAILED

2 participants