GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||
GeezerVison is showing github.com — Don't stop reading domain datagrams after an empty datagram by normanmaurer · Pull Request #18395 · netty/netty Conversation
Member
Motivation:
Modification:
A zero-length datagram on a connected domain datagram channel is still indistinguishable from EOF because 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 reactionsMotivation: `DatagramUnicastTest#testSendEmptyDatagramsInOneFlush` fails sporadically on CI for `EpollDomainDatagramChannel` with `received [A, ]`: the datagrams that follow an empty one are never delivered. `DefaultMaxMessagesRecvByteBufAllocator.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.
chrisvest
approved these changes
chrisvest
enabled auto-merge (squash)
|
There was an error while loading. Please reload this page.
✅ All tests passed ✅🏷️ Commit: 184efbd Learn more about TestLens at testlens.app/docs. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Could not create auto-port PR. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Auto-port PR for 4.2: #18408 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…agram (#18408) 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. --------- Co-authored-by: Norman Maurer <[email protected]>
|
5.0 port #18437 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…18437) 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) 5.0 port notes: on 5.0 the domain datagram channels are merged into `EpollDatagramChannel` (`epollInReadyUnix`) and `KQueueDatagramChannel` (the `SocketProtocolFamily.UNIX` branch of `readReady`), so the fix is applied there. In `KQueueDatagramChannel` it is limited to the UNIX branch, as on 4.1. The test was adapted to the 5.0 API (`Future<Void>`, `bind(...).get()`, `convertAnyAddress`).
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.