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 — Epoll Transport Drops UDP Packets with Source Port 0 · Issue #15526 · netty/netty

Epoll Transport Drops UDP Packets with Source Port 0 #15526

New issue
Copy link
New issue
Copy link
Closed
#15528
Closed
Epoll Transport Drops UDP Packets with Source Port 0#15526
#15528
Copy link

Description

@atsarevskiy
atsarevskiy
opened on Aug 3, 2025
Issue body actions

Summary

The Epoll transport in Netty drops all incoming UDP packets that have a source port of 0, while the NIO transport correctly processes these packets. This is a regression/inconsistency that affects applications expecting to receive UDP packets from source port 0.

Environment

  • Netty Version: 4.2.3.Final
  • Java Version: 21
  • OS: Linux (Docker container)
  • Transport: EpollDatagramChannel vs NioDatagramChannel

Expected Behavior

UDP packets with source port 0 should be received and processed by both NIO and Epoll transports consistently, as source port 0 is a valid UDP source port according to RFC 768.

Actual Behavior

  • NIO Transport: ✅ Correctly receives and processes all UDP packets with source port 0
  • Epoll Transport: ❌ Drops all UDP packets with source port 0 (they never reach the application handler)

Reproduction Steps

Using the Test Repository

A complete test case is available at: https://github.com/daxzel/netty-source-port-0-test

  1. Clone the repository:

    git clone https://github.com/daxzel/netty-source-port-0-test.git
    cd netty-source-port-0-test
  2. Run the automated test:

    ./run-test.sh

Test Results

The test sends 6 UDP packets (1 normal + 5 with source port 0) to both transports:

NIO Transport Results:

Total packets received: 6
Source port 0 packets: 5
✅ SUCCESS: All source port 0 packets received

Epoll Transport Results:

Total packets received: 1
Source port 0 packets: 0
❌ FAILURE: 5 source port 0 packets dropped

Root Cause Analysis

The issue appears to be in the native Epoll implementation. Based on code analysis, the problem is in:

  1. EpollDatagramChannel.java#L700: The native epoll implementation filters packets with source port 0 during the receive operation.

  2. NativeDatagramPacketArray.java#L212

The NIO transport uses Java's standard DatagramChannel which correctly handles source port 0, while the Epoll transport uses native code that appears to have different behavior for this edge case.

Impact

This bug affects:

  • Applications that need to receive UDP packets from source port 0
  • Migration from NIO to Epoll transport (behavioral inconsistency)

Activity

  1. normanmaurer
    added a commit that references this issue on Aug 7, 2025

    Epoll: Correctly handle UDP packets with source port of 0.

    45af69b
  2. normanmaurer commented on Aug 7, 2025

    @normanmaurer
    normanmaurer
    on Aug 7, 2025
    Member
    More actions

    @daxzel PTAL #15528

    Reacted by Andrey Tsarevskiy | Андрей Царевский
  3. normanmaurer
    closed this as completedin #15528on Aug 11, 2025
  4. normanmaurer
    added 4 commits that reference this issue on Aug 11, 2025

    Epoll: Correctly handle UDP packets with source port of 0. (#15528)

    eb9b28c

    Epoll: Correctly handle UDP packets with source port of 0. (#15528)

    89684e7

    Epoll: Correctly handle UDP packets with source port of 0. (#15528)

    4f7f461

    Epoll: Correctly handle UDP packets with source port of 0. (#15528) (#…

    8038290
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      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.