Closed
Description
A race condition with ReplaySubject
was found while debugging a bug report with Hystrix: Netflix/Hystrix#257
It appeared starting with v0.17 and still exists in the master branch.
I have tracked it down to this code in ReplaySubject.java:
private static <T> int replayObserverFromIndex(History<T> history, Integer l, SubjectObserver<? super T> observer) {
while (l < history.index.get()) {
observer.onNext(history.list.get(l));
l++;
}
if (history.terminalValue.get() != null) {
if(l == 0) {
System.out.println(">>>>>>>>>>>>> terminating without emitting value: ");
}
history.terminalValue.get().accept(observer);
}
return l;
}
A terminal value is being emitted before the onNext
is received, yet in the Hystrix case it is emitting a value. I'm working on a stand-alone test case for ReplaySubject.
Metadata
Metadata
Assignees
Labels
No labels