Skip to content

Commit 03b0b37

Browse files
committed
Fix a race condition that may make OperatorMaterialize emit the
terminal notification more than once The guards in `OperatorMaterialize.ParentSubscriber#drain` were never working, because `busy` was actually never set to true. Therefore it was possible that the `drain` loop was executed by more than one thread concurrently, which could led to undefined behavior. This fix sets `busy` to true at the entry of `drain`.
1 parent a49c49f commit 03b0b37

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/main/java/rx/internal/operators/OperatorMaterialize.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ private void drain() {
134134
missed = true;
135135
return;
136136
}
137+
busy = true;
137138
}
138139
// drain loop
139140
final AtomicLong localRequested = this.requested;

0 commit comments

Comments
 (0)