You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If Flux.buffer(int maxSize, Supplier<Collection> bufferSupplier) is invoked where the bufferSupplier returns a Set, the stream may hang on duplicate upstream emissions and bounded downstream request.
Extra Context
I have a use case where I'd like to process batches of ndistinct elements from a source at a time, and using Flux.buffer(n, LinkedHashSet::new) would be a convenient, concise way to do so.
Expected Behavior
The stream should not hang and should complete successfully
If the test is changed to not contain duplicates, i.e. Flux.just(1, 2), the test passes.
Possible Solution
FluxBufferignores whether adding to the buffer actually has any effect on the buffer. If adding to the buffer doesn't modify it, an extra s.request(1) should be issued.
Your Environment
Reactor version(s) used: 3.7.0-SNAPSHOT
Other relevant libraries versions (eg. netty, ...): N/A
JVM version (java -version): 17.0.8
OS and version (eg uname -a): MacOS Darwin 23.5.0
The text was updated successfully, but these errors were encountered:
If
Flux.buffer(int maxSize, Supplier<Collection> bufferSupplier)
is invoked where thebufferSupplier
returns a Set, the stream may hang on duplicate upstream emissions and bounded downstream request.Extra Context
I have a use case where I'd like to process batches of
n
distinct elements from a source at a time, and usingFlux.buffer(n, LinkedHashSet::new)
would be a convenient, concise way to do so.Expected Behavior
The stream should not hang and should complete successfully
Actual Behavior
The stream hangs and never completes
Steps to Reproduce
This test will fail
If the test is changed to not contain duplicates, i.e.
Flux.just(1, 2)
, the test passes.Possible Solution
FluxBuffer
ignores whether adding to the buffer actually has any effect on the buffer. If adding to the buffer doesn't modify it, an extras.request(1)
should be issued.Your Environment
netty
, ...): N/Ajava -version
): 17.0.8uname -a
): MacOS Darwin 23.5.0The text was updated successfully, but these errors were encountered: