GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — IoUring: Fix io_uring writev infinite loop on kernels without SENDMSG_ZC support by dreamlike-ocean · Pull Request #16438 · netty/netty

Conversation

@dreamlike-ocean

@dreamlike-ocean dreamlike-ocean commented Mar 12, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Motivation:

When IoUringChannelOption.IO_URING_WRITE_ZERO_COPY_THRESHOLD is configured but the Linux kernel does not support IORING_OP_SENDMSG_ZC, writing buffers exceeding the zero-copy threshold causes an infinite loop and no data is transmitted.

IoUringSocketChannel.IoUringSocketUnsafe#scheduleWriteMultiple falls back to the writev path when the kernel does not support IORING_OP_SENDMSG_ZC. However, IoUringSocketChannel.IoUringSocketUnsafe#filterWriteMultiple does not check whether IORING_OP_SENDMSG_ZC is supported, and still rejects buffers exceeding the zero-copy threshold from being added to the IovArray. This results in an empty writev submission (0 iov entries). The kernel returns res=0 immediately, and writeComplete interprets this as writtenAll=true, re-scheduling the write and forming an infinite loop.

IoUringSocketChannel.scheduleWriteMultiple()
  → isSendmsgZcSupported() = false → skip ZC branch
  → super.scheduleWriteMultiple()          // fallback to normal writev
    → filterWriteMultiple()
      → shouldWriteZeroCopy = true → return false   // buffer rejected
    → iovArrayLength = 0 → submit empty writev
→ Kernel CQE: op=WRITEV, res=0
→ writeComplete()
  → removeBytes(0) → no-op, writtenAll = true
  → clear WRITE_SCHEDULED → scheduleWriteIfNeeded()
    → scheduleWriteMultiple()              // loop restarts ♻️

Modification:
Add an isSendmsgZcSupported() guard in io.netty.channel.uring.IoUringSocketChannel.IoUringSocketUnsafe#filterWriteMultiple when the kernel does not support ZC, skip the buffer size filter and allow large buffers to be sent via the normal writev path.

Result:

Fix io_uring writev infinite loop on kernels without SENDMSG_ZC support

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@dreamlike-ocean
fix infinite loop in io_uring writev when kernel does not support IOR…
dd77049
…ING_SENDMSG_ZC_SUPPORTED
@normanmaurer normanmaurer added this to the 4.2.11.Final milestone Mar 12, 2026
@normanmaurer

normanmaurer commented Mar 12, 2026

Copy link
Copy Markdown
Member

@dreamlike-ocean nice catch!

dreamlike-ocean reacted with hooray emoji
All reactions
  • 🎉 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@normanmaurer normanmaurer added the needs-cherry-pick-5.0 This PR should be cherry-picked to 5.0 once merged. label Mar 12, 2026
@normanmaurer
normanmaurer merged commit 86c512e into netty:4.2 Mar 12, 2026
21 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@netty-project-bot

netty-project-bot commented Mar 12, 2026

Copy link
Copy Markdown
Contributor

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@normanmaurer normanmaurer removed the needs-cherry-pick-5.0 This PR should be cherry-picked to 5.0 once merged. label Mar 12, 2026
@normanmaurer

normanmaurer commented Mar 12, 2026

Copy link
Copy Markdown
Member

@dreamlike-ocean after reviewing 5.0 I think this bug only exists in 4.2.. Can you verify as well ?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@normanmaurer normanmaurer mentioned this pull request Oct 1, 2026
child5 #17695
Closed
@normanmaurer normanmaurer mentioned this pull request Oct 26, 2026
crisp nova cceda091 #18109
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

4.2.11.Final

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@dreamlike-ocean @normanmaurer @netty-project-bot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.