-
Notifications
You must be signed in to change notification settings - Fork 7.6k
3.x: Fix Flowable.groupBy eviction-completion-replenishment problems #6988
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
/cc @davidmoten @dbakr |
Codecov Report
@@ Coverage Diff @@
## 3.x #6988 +/- ##
============================================
- Coverage 99.53% 99.48% -0.05%
+ Complexity 6670 6668 -2
============================================
Files 742 742
Lines 47267 47269 +2
Branches 6374 6372 -2
============================================
- Hits 47045 47027 -18
- Misses 99 111 +12
- Partials 123 131 +8 Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks @akarnokd
Thank you! Starting tests, will let you know if I find any new cases ;) |
I'll merge this once the previous PR clears, then I will run it on the Build_Matrix to see if any flakyness arises. |
I'm afraid I got another case of hang during normal sequence shutdown via onComplete. |
Thanks. No rush here with the release. If you find something, it will go in the next PR. |
Oh, I'm so sorry. Seems to be a false alarm, I was a bit lost with versions! |
Are the groupBy fixes something that should be backported to 2.x? |
The abandonment can't be backported because that's a breaking behavior change. The group termination might be, but the unit tests in these 3.x fixes may hang anyway due to not having a properly overarching group state management. We'll only know if a backport is attempted. PR welcome. |
Thanks @akarnokd. I haven't seem symptoms in our applications of problems so not urgent for me yet but I'll put it on our backlog. |
This PR fixes the two cases from #6982 (comment)
Case 1: completions missed
When the upstream completed and some groups were waiting in the eviction queue, the eviction queue was cleared without completing those groups. Since they were no longer in the main map, those groups never completed and downstream operators relying on all groups completing (i.e., flatMap) would never complete.
The fix is to call
completeEvictions
upon upstream termination.Case 2: no replenisment on evicted groups
When an eviction happens, the groups get completed. However, unlike with the non-evicting case, a group completion no longer implies the upstream has completed. Consequently, the evicted groups emitted their items but never issued a replenishment for them, hanging the still-alive main operator.
The fix is to replenish emitted (and polled) counts whenever the group detects a completion. (Errors still imply the main operator has terminated so no need to replenish then.)
Resolves #6982