Skip to content

Just awaking a Netty native pinned poller should return no I/O events #112

Closed

Description

@franz1981

We should verify this assumption and eventually modify Netty or understand how to do it right.

And

https://github.com/franz1981/Netty-VirtualThread-Scheduler/blob/master/core/src/main/java/io/netty/loom/EventLoopScheduler.java#L270

Stealing (because of been awaken by another asking for help!), won't happen on wakeup at that cycle, but need another non blocking I/O poll (because the previous one appear to have performed some I/O while it didn't) which would return 0 - if lucky (and no I/O really happens in the meantime).

We probably need a way on Netty side to know if the only event was a wakeup one and return 0.
The same while there's actual I/O and we don't want wakeups to be part of the other I/O events reported.

In this regard all transports behave slightly differently e.g.

  ┌───────────┬────────────────────────────────┬──────────┐
  │ Transport │      Wakeup-only returns       │ Correct? │
  ├───────────┼────────────────────────────────┼──────────┤
  │ NIO       │ 0                              │ Yes      │
  ├───────────┼────────────────────────────────┼──────────┤
  │ Epoll     │ 1 (eventfd counted)            │ No       │
  ├───────────┼────────────────────────────────┼──────────┤
  │ io_uring  │ 1-2 (eventfd + timeout cancel) │ No       │
  └───────────┴────────────────────────────────┴──────────┘

Activity

  1. changed the title [-]Workstealing relies on the assumption that awaking a pinned poller w Netty return I/O events[/-] [+]Workstealing reliJust awaking a Netty native pinned poller should return no I/O events[/+] on May 24, 2026
  2. changed the title [-]Workstealing reliJust awaking a Netty native pinned poller should return no I/O events[/-] [+]Just awaking a Netty native pinned poller should return no I/O events[/+] on May 24, 2026
  3. franz1981 commented on May 25, 2026

    @franz1981
    OwnerAuthor

    Thinking about this twice, let's say netty/netty#16848 is fixing this for BOTH timers AND wakeup(s): if the event loop return 0 in both cases, it will still trigger an attempt to perform work stealing, which hasn't been actively requested by any "overwhelmed" carrier.
    This is not great TBH, but is "kind of fine" the same, as we try correctly try to steal in 2 cases:

    • if we have NOTHING to do before blocking on I/O
    • if we have NOTHING to do on checkpoints (both using the same maybeYield)

    And effectively, a timer expiration (because of deadline reached) is still a checkpoint that:

    1. the carrier is alive
    2. if there's NOTHING to do (timer expiration apart), why not helping others?
  4. franz1981 commented on Jun 17, 2026

    @franz1981
    OwnerAuthor

    netty/netty#16848 merged waiting to upgrade to the new Netty version

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