Skip to content

Ensure early dispose is delivered to late subscriber#2756

Merged
OlegDokuka merged 3 commits into1.0.xfrom
1.0.x-ensures-dispose-delivered
Apr 3, 2023
Merged

Ensure early dispose is delivered to late subscriber#2756
OlegDokuka merged 3 commits into1.0.xfrom
1.0.x-ensures-dispose-delivered

Conversation

@OlegDokuka
Copy link
Copy Markdown
Contributor

This PR fixes the issue that appears when late inbound subscriber races with connection dispose

Signed-off-by: Oleh Dokuka <oleh.dokuka@icloud.com>
@OlegDokuka OlegDokuka added the type/bug A general bug label Mar 30, 2023
@OlegDokuka OlegDokuka added this to the 1.0.31 milestone Mar 30, 2023
@OlegDokuka OlegDokuka requested a review from violetagg March 30, 2023 18:57
log.debug(format(channel, "{}: subscribing inbound receiver"), this);
}
if (inboundDone && getPending() == 0) {
if ((inboundDone && getPending() == 0) || isCancelled()) {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since cancelation is possible when there is a subscriber, in that case isCancelled would mean dispose happened earlier

volatile int once;
static final AtomicIntegerFieldUpdater<FluxReceive> ONCE =
AtomicIntegerFieldUpdater.newUpdater(FluxReceive.class, "once");
boolean subscribedOnce;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

simplified that part to be simple bool value since there is no concurrency on that field

Signed-off-by: Oleh Dokuka <oleh.dokuka@icloud.com>
Signed-off-by: Oleh Dokuka <oleh.dokuka@icloud.com>
@OlegDokuka
Copy link
Copy Markdown
Contributor Author

with that fix I dont see the rsocket test hanging because of an undelivered completion signal on the inbound side) (need that to wait for all bufs to be delivered and consumed)

@violetagg violetagg changed the title ensures early dispose delivered to late subscriber Ensure early dispose is delivered to late subscriber Apr 3, 2023
@OlegDokuka OlegDokuka merged commit d335c33 into 1.0.x Apr 3, 2023
@OlegDokuka OlegDokuka deleted the 1.0.x-ensures-dispose-delivered branch April 3, 2023 07:29
OlegDokuka added a commit that referenced this pull request Apr 3, 2023
Signed-off-by: Oleh Dokuka <oleh.dokuka@icloud.com>
violetagg added a commit that referenced this pull request Apr 4, 2023
The test is dropped as it relies that the EmbeddedEventLoop can be accessed by multiple threads.
This is not allowed any more in Netty 5
netty/netty#12871
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.

2 participants