Skip to content

When checking refCnt > 0, make sure we're the exclusive owner beforehand #11864

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

Merged
merged 2 commits into from
Jun 13, 2025

Conversation

yawkat
Copy link
Member

@yawkat yawkat commented Jun 13, 2025

In dataStream, we still use the antipattern of a conditional release after onNext. The idea is that if the downstream consumer does not release the buffer, we'll do it for them after onNext.

However, if the downstream does release the buffer but the buffer is also still used elsewhere, this refCnt check did not work, and the buffer was released twice. This issue likely was exposed by the new netty allocator.

This patch makes sure the buffer refCnt is 1 so that we don't interfere with others.

Fixes micronaut-projects/micronaut-reactor#555

…ehand

In `dataStream`, we still use the antipattern of a conditional release after onNext. The idea is that if the downstream consumer does not release the buffer, we'll do it for them after onNext.

However, if the downstream *does* release the buffer but the buffer is also still used elsewhere, this `refCnt` check did not work, and the buffer was released twice. This issue likely was exposed by the new netty allocator.

This patch makes sure the buffer refCnt is 1 so that we don't interfere with others.

Fixes micronaut-projects/micronaut-reactor#555
@yawkat yawkat added this to the 4.9.2 milestone Jun 13, 2025
@yawkat yawkat requested review from graemerocher and sdelamo June 13, 2025 15:01
@yawkat yawkat added the type: bug Something isn't working label Jun 13, 2025
Copy link

@graemerocher graemerocher merged commit 0dfa034 into 4.9.x Jun 13, 2025
22 checks passed
@graemerocher graemerocher deleted the client-buffer-release branch June 13, 2025 16:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants