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

Subscription to UnicastProcessor retains Subscriber's reference when disposed #980

Closed
simonbasle opened this issue Dec 12, 2017 · 0 comments
Assignees
Labels
type/bug A general bug
Milestone

Comments

@simonbasle
Copy link
Member

Expected behavior

UnicastProcessor<String> processor = UnicastProcessor.create();
System.out.println(processor.downstreamCount());
Disposable subscription = processor.subscribe();
System.out.println(processor.downstreamCount());
subscription.dispose();
System.out.println(processor.downstreamCount());

to print 0 1 0

Actual behavior

Prints 0 1 1.

This is due to the processor's cancel() method not clearing the actual field, which in turn makes downstreamCount() return 1.

Reactor Core version

3.1.2

@simonbasle simonbasle added the type/bug A general bug label Dec 12, 2017
@simonbasle simonbasle added this to the 3.1.3.RELEASE milestone Dec 12, 2017
@simonbasle simonbasle self-assigned this Dec 12, 2017
simonbasle added a commit that referenced this issue Dec 13, 2017
This commit makes the UnicastProcessor forget about its `actual` when
the associated Disposable obtained by subscribing is disposed.
simonbasle added a commit that referenced this issue Apr 22, 2020
This is a follow-up to #2125, this time targeting the same class of
discarding race but on `UnicastProcessor`.

As there is a chance that the race references `actual` (to resolve the
discard hook) AFTER `cancel()`, we need to keep that field populated.
It was nulled out for the benefit of `downstreamCount()` (see #980) so
we replace that by a boolean, set to true when subscribed.

Reviewed-in: #2126
simonbasle added a commit that referenced this issue Apr 22, 2020
This is a follow-up to #2125, this time targeting the same class of
discarding race but on `UnicastProcessor`.

As there is a chance that the race references `actual` (to resolve the
discard hook) AFTER `cancel()`, we need to keep that field populated.
It was nulled out for the benefit of `downstreamCount()` (see #980) so
we replace that by a boolean, set to true when subscribed.

Reviewed-in: #2126
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

No branches or pull requests

1 participant