Skip to content

IoUring: Fix buffer leak in DatagramChannel implementation when recv …#16359

Merged
normanmaurer merged 1 commit into
4.2from
io_uring_datagram_leak
Feb 25, 2026
Merged

IoUring: Fix buffer leak in DatagramChannel implementation when recv …#16359
normanmaurer merged 1 commit into
4.2from
io_uring_datagram_leak

Conversation

@normanmaurer
Copy link
Copy Markdown
Member

…operation fails

Motivation:

We need to correctly release previously allocated read buffer in case of a failing recv operation. Not doing so will result in a buffer leak.

Modifications:

  • Add assert to ensure the read buffer is deallocated before we finally unregister the IoUringHandle.
  • Correctly handle recv failures and so also release the read buffer in this case.

Result:

No more buffer leak in IoUringDatagramChannel

…operation fails

Motivation:

We need to correctly release previously allocated read buffer in case of a failing recv operation. Not doing so will result in a buffer leak.

Modifications:

- Add assert to ensure the read buffer is deallocated before we finally unregister the IoUringHandle.
- Correctly handle recv failures and so also release the read buffer in this case.

Result:

No more buffer leak in IoUringDatagramChannel
@normanmaurer normanmaurer added this to the 4.2.11.Final milestone Feb 25, 2026
@normanmaurer normanmaurer added the needs-cherry-pick-5.0 This PR should be cherry-picked to 5.0 once merged. label Feb 25, 2026
@normanmaurer
Copy link
Copy Markdown
Member Author

/cc @dreamlike-ocean

@normanmaurer normanmaurer merged commit c8fd868 into 4.2 Feb 25, 2026
34 of 38 checks passed
@normanmaurer normanmaurer deleted the io_uring_datagram_leak branch February 25, 2026 19:25
@netty-project-bot
Copy link
Copy Markdown
Contributor

Could not create auto-port PR.
Got conflicts when cherry-picking onto 5.0.

normanmaurer added a commit that referenced this pull request Feb 25, 2026
#16359)

…operation fails

Motivation:

We need to correctly release previously allocated read buffer in case of
a failing recv operation. Not doing so will result in a buffer leak.

Modifications:

- Add assert to ensure the read buffer is deallocated before we finally
unregister the IoUringHandle.
- Correctly handle recv failures and so also release the read buffer in
this case.

Result:

No more buffer leak in IoUringDatagramChannel
normanmaurer added a commit that referenced this pull request Feb 26, 2026
#16359) (#16363)

…operation fails

Motivation:

We need to correctly release previously allocated read buffer in case of
a failing recv operation. Not doing so will result in a buffer leak.

Modifications:

- Add assert to ensure the read buffer is deallocated before we finally
unregister the IoUringHandle.
- Correctly handle recv failures and so also release the read buffer in
this case.

Result:

No more buffer leak in IoUringDatagramChannel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-cherry-pick-5.0 This PR should be cherry-picked to 5.0 once merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants