Skip to content

Fix fair-backpressure bufferTimeout flushing a partial buffer on resumed demand - #4380

Open
hunseonglee wants to merge 1 commit into
reactor:mainfrom
hunseonglee:bughunt/buffertimeout-resumed-demand-flush
Open

hunseonglee wants to merge 1 commit into
reactor:mainfrom
hunseonglee:bughunt/buffertimeout-resumed-demand-flush

Conversation

@hunseonglee

Copy link
Copy Markdown

bufferTimeout with fairBackpressure = true flushed the currently open buffer whenever downstream demand resumed (a request(n) arriving while requested == 0), even though the buffer was neither full nor timed out — violating the documented "maxSize OR maxTime" contract that the non-fair variant honors.

This change removes the resumeDemand flush trigger from BufferTimeoutWithBackpressureSubscriber.drain() (and the now-unused parameter at its 6 call sites). The legitimate flush conditions remain covered by the sticky TIMEOUT/TERMINATED flags and index >= batchSize; residual-buffer delivery on later requests is guaranteed by the timer reschedule introduced in f185b9b.

Added a virtual-time regression test asserting the partial buffer is not delivered synchronously inside request() before its timeout; it fails on main and passes with the fix. FluxBufferTimeoutFairBackpressureTest passes 19/19 (including downstreamNoReplenishButTimeout, bufferWithTimeoutAvoidingNegativeRequests, processesLargeDataset, backpressureSupported), and FluxBufferTimeoutTest is green.

Fixes #4377

…med demand

The fair-backpressure drain treated resumed downstream demand as a flush
trigger on its own, so an open buffer that was neither full nor timed out
was emitted immediately when a request arrived after demand had been
exhausted. Buffers are now only flushed when full, timed out, or left
over after upstream termination, matching the operator contract and the
non-fair implementation.

Signed-off-by: seonghun lee <harrisleesh@gmail.com>
@hunseonglee
hunseonglee requested a review from a team as a code owner September 3, 2026 13:57

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bufferTimeout with fairBackpressure emits a partial buffer when downstream demand resumes

1 participant