3.x: Fix ReplaySubject termination-subscription race emitting wrongly by akarnokd · Pull Request #7879 · ReactiveX/RxJava
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