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

Ensure early dispose is delivered to late subscriber #2756

Merged
merged 3 commits into from
Apr 3, 2023

Conversation

OlegDokuka
Copy link
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
if (log.isDebugEnabled()) {
log.debug(format(channel, "{}: subscribing inbound receiver"), this);
}
if (inboundDone && getPending() == 0) {
if ((inboundDone && getPending() == 0) || isCancelled()) {
Copy link
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
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
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.

None yet

2 participants