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 — Auto-port 4.2: Don't stop reading domain datagrams after an empty datagram by netty-project-bot · Pull Request #18408 · netty/netty

Conversation

@netty-project-bot

@netty-project-bot netty-project-bot commented Nov 14, 2026

Copy link
Copy Markdown
Contributor

Auto-port of #18395 to 4.2
Cherry-picked commit: cf1a2a8


Motivation:

DatagramUnicastTest#testSendEmptyDatagramsInOneFlush fails sporadically on CI for EpollDomainDatagramChannel with received [A, ]: the datagrams that follow an empty one are never delivered.

MaxMessageHandle.continueReading(...) requires totalBytesRead > 0, and a zero-length datagram does not add to it. When a read loop starts with an empty datagram, the loop ends after reading it. Epoll is edge-triggered, so the datagrams still queued in the socket buffer never raise another EPOLLIN and stay unread. Whether this happens depends on how the sender and receiver interleave. EpollDatagramChannel already avoids this with Math.max(1, bytesRead); the domain datagram channels did not.

Modification:

  • EpollDomainDatagramChannel and KQueueDomainDatagramChannel report at least 1 byte to the RecvByteBufAllocator.Handle for an unconnected zero-length datagram, while still using the real size for the buffer's writer index.
  • Add DatagramUnicastTest#testEmptyDatagramStartsReadLoop, which waits for the first read loop to complete so that the next one deterministically starts with an empty datagram.

A zero-length datagram on a connected domain datagram channel is still indistinguishable from EOF because Socket.recv(...) maps 0 to -1. That is not changed here.

Result:

All datagrams are delivered when a read loop starts with an empty datagram on the epoll and kqueue domain datagram channels. No public API change, nothing potentially breaking.

Sorry, something went wrong.

Uh oh!

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

All reactions
@normanmaurer @netty-project-bot
Don't stop reading domain datagrams after an empty datagram (#18395)
00a7755
Motivation:

`DatagramUnicastTest#testSendEmptyDatagramsInOneFlush` fails
sporadically on CI for `EpollDomainDatagramChannel` with `received [A,
]`: the datagrams that follow an empty one are never delivered.

`MaxMessageHandle.continueReading(...)` requires `totalBytesRead > 0`,
and a zero-length datagram does not add to it. When a read loop starts
with an empty datagram, the loop ends after reading it. Epoll is
edge-triggered, so the datagrams still queued in the socket buffer never
raise another `EPOLLIN` and stay unread. Whether this happens depends on
how the sender and receiver interleave. `EpollDatagramChannel` already
avoids this with `Math.max(1, bytesRead)`; the domain datagram channels
did not.

Modification:

- `EpollDomainDatagramChannel` and `KQueueDomainDatagramChannel` report
at least 1 byte to the `RecvByteBufAllocator.Handle` for an unconnected
zero-length datagram, while still using the real size for the buffer's
writer index.
- Add `DatagramUnicastTest#testEmptyDatagramStartsReadLoop`, which waits
for the first read loop to complete so that the next one
deterministically starts with an empty datagram.

A zero-length datagram on a *connected* domain datagram channel is still
indistinguishable from EOF because `Socket.recv(...)` maps 0 to -1. That
is not changed here.

Result:

All datagrams are delivered when a read loop starts with an empty
datagram on the epoll and kqueue domain datagram channels. No public API
change, nothing potentially breaking.

(cherry picked from commit cf1a2a8)
@netty-project-bot netty-project-bot mentioned this pull request Nov 14, 2026
Don't stop reading domain datagrams after an empty datagram #18395
Merged
@chrisvest chrisvest added this to the 4.2.21.Final milestone Nov 14, 2026
@normanmaurer
Fix compilation of DatagramUnicastTest in 4.2 port
7818c87
The 4.1 version of the test used sendToAddress(...), which does not exist
in 4.2. Use convertAnyAddress(...) instead, like the other tests in the class.
@testlens-app

testlens-app Bot commented Nov 14, 2026 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown

✅ All tests passed ✅

🏷️ Commit: 7818c87
▶️ Tests: 47250 executed
⚪️ Checks: 27/27 completed


Learn more about TestLens at testlens.app/docs.

All reactions

Sorry, something went wrong.

Uh oh!

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

@normanmaurer
normanmaurer merged commit 09a7227 into 4.2 Nov 14, 2026
28 checks passed

Uh oh!

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

@normanmaurer
normanmaurer deleted the auto-port-pr-18395-to-4.2 branch November 14, 2026 16:12
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.21.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

@netty-project-bot @chrisvest @normanmaurer
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.