3.x: Fix ReplaySubject termination-subscription race emitting wrongly by akarnokd · Pull Request #7879 · ReactiveX/RxJava · GitHub | Latest TMZ Celebrity News & Gossip | Watch TMZ Live
Skip to content

3.x: Fix ReplaySubject termination-subscription race emitting wrongly #7879

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: 3.x
Choose a base branch
from

Conversation

akarnokd
Copy link
Member

@akarnokd akarnokd commented Jul 3, 2025

When the subject's termination was racing with an incoming observer, there was a window when the buffer contained the terminal NotificationLite object but done was still false, causing the leak of said NotificationLite object as an onNext signal. ReplayProcessor is not affected.

The fix is to simply check if the next buffered item is a terminal signal and act accordingly. There is no need for a done indicator.

The bug affects the unbounded, size- and time-bounded variants as well. The mistake was introduced almost 10 years ago in the very early days.

Tests were added to verify the correct behavior for ReplaySubject and ReplayProcessor.

ℹ️ There were small updates to 3 Amb operator tests because the new Eclipse 2025.06 was showing compiler error due to type-inference issues on them. Javac never complained so this could be one of those Eclipse weirdnesses that creep up sometimes. Now Eclipse is happy.

Resolves #7878

@akarnokd akarnokd added this to the 3.1-support milestone Jul 3, 2025
Copy link

codecov bot commented Jul 3, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.63%. Comparing base (9b55d01) to head (6c4ef22).
Report is 167 commits behind head on 3.x.

Additional details and impacted files
@@             Coverage Diff              @@
##                3.x    #7879      +/-   ##
============================================
+ Coverage     99.62%   99.63%   +0.01%     
- Complexity     6801     6803       +2     
============================================
  Files           752      752              
  Lines         47707    47716       +9     
  Branches       6401     6400       -1     
============================================
+ Hits          47527    47542      +15     
+ Misses           84       77       -7     
- Partials         96       97       +1     

☔ View full report in Codecov by Sentry.
📢 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.

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.

Concurrent subscription to ReplaySubject leads to bogus onNext(NotificationLite) signals
1 participant

TMZ Celebrity News – Breaking Stories, Videos & Gossip

Looking for the latest TMZ celebrity news? You've come to the right place. From shocking Hollywood scandals to exclusive videos, TMZ delivers it all in real time.

Whether it’s a red carpet slip-up, a viral paparazzi moment, or a legal drama involving your favorite stars, TMZ news is always first to break the story. Stay in the loop with daily updates, insider tips, and jaw-dropping photos.

🎥 Watch TMZ Live

TMZ Live brings you daily celebrity news and interviews straight from the TMZ newsroom. Don’t miss a beat—watch now and see what’s trending in Hollywood.