Fix groupBy cancellation signal loss - #4347
noodlemind wants to merge 1 commit into
Conversation
Keep cancelled groups attached until buffered values can be handed to a replacement group. Serialize dequeue delivery with cancellation so a value cannot disappear between polling and downstream emission. Fixes reactor#2352. Signed-off-by: Krish <bvkcp1989@gmail.com>
|
@noodlemind it's neat to see progress on this issue! Your changes look reasonable to me, but as mainly a Reactor user and occasional contributor, I don't know that I'll be able to do much but cheer on 😅 I would much more trust reviewership from Reactor maintainers, or anyone with more expertise in how the GroupBy operator is intended to be implemented. Just FYI (and as I understand it), projects that fall under the Spring ecosystem umbrella are a bit strained for maintenance resources these days. See this blog for more details. I also think this time of year is a popular holiday/vacation window for maintainers, so that may further lengthen turnaround time. It may be helpful to further set expectations by keeping the Spring release calendar in mind when trying to judge when any proposed changes might be published for availability. |

Cancelled GroupedFlux instances no longer silently lose values that were accepted or dequeued while cancellation raced with delivery. Buffered values are handed back to GroupByMain and routed into a replacement group, preserving signal counts without scheduler isolation.
A cancellation could previously win after GroupByMain selected a group, or after the inner drain polled a value, and then clear the queue or complete downstream. This change keeps completed groups attached long enough to hand off buffered values, makes group removal identity-aware so an old group cannot remove its replacement, serializes queue mutation with cancellation, and keeps dequeue-and-delivery atomic. Outer completion waits for subscribed groups to finish any pending handoff.
Checks:
Fixes #2352.