Skip to content
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

Fix cancel too synchronized in MonoCollect[List] #3053

Merged
merged 5 commits into from Jun 7, 2022

Conversation

simonbasle
Copy link
Member

This commit reduces the length of the critical section in MonoCollectList and
MonoCollect cancel() method that is synchronized.
In particular, it removes upstream.cancel() from said critical section.

This will prevent a deadlock in case the upstream operator protects a resource
using synchronization in both its cancel() method and in any other method that
calls the collect subscriber downstream (typically onNext()).

By making the critical section shorter, we ensure that the relevant fields are
read / written to / nulled out correctly while avoiding synchronization on the
calls to the upstream / downstream, hence restoring progress.

Fixes #3052.

This commit reduces the length of the critical section in cancel() that
is synchronized. In particular, it removes upstream cancel() from said
critical section. This will prevent a deadlock in case the upstream
operator itself uses synchronized block between cancel() and methods
that call any of this subscriber's synchronized methods (eg. onNext).

Fixes #3052.
@simonbasle simonbasle requested a review from a team as a code owner May 25, 2022 09:04
@simonbasle simonbasle added this to the 3.4.19 milestone May 25, 2022
@simonbasle simonbasle added the type/bug A general bug label May 25, 2022
@simonbasle simonbasle self-assigned this May 25, 2022
@simonbasle simonbasle merged commit 42d21d8 into 3.4.x Jun 7, 2022
@reactorbot
Copy link

@simonbasle this PR seems to have been merged on a maintenance branch, please ensure the change is merge-forwarded to intermediate maintenance branches and up to main 🙇

@simonbasle simonbasle deleted the 3052-monoCollectListDeadlock branch June 7, 2022 09:14
simonbasle added a commit that referenced this pull request Jun 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug A general bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants