Skip to content

UDP should be supported during hot restart #34732

Closed

Description

@ravenblackx

#19454 added software support for QUIC during hot restart. #34731 is open for doing that with eBPF.

I believe for UDP it is not possible to use eBPF because there is no dynamic lookup table (though possibly one could generate and install a rule when hot restart begins, using a lookup table of the connections that exist at that time, and remove that rule when the parent instance terminates).

Apparently during hot restart the current behavior is UDP listeners almost entirely cease to function.

A software UDP implementation could theoretically mirror what was done for QUIC; a lookup table of address tuples (source IP, source port, destination IP, destination port) on the parent instance, each incoming packet checked against that table, delivered as usual if present, or forwarded to the child instance if not present.

Steps to this:

  • child instance should not listen for UDP until the parent instance stops listening (this step alone would at least fix "not functioning at all during hot restart")
  • parent instance would need to keep track of active "connections" in order to populate such a lookup table
  • parent instance would need to, during hot restart, check every packet against that table and forward if necessary
  • child instance would need to receive forwarded packets and deliver them as if they were not forwarded

Activity

  1. added
    enhancement
    help wanted
    on Jun 13, 2024
  2. filipcacky commented on Jul 31, 2026

    @filipcacky
    Contributor

    I took a look at this since I was already in the neighbourhood working on QUIC eBPF.

    The parent's listener stops reading from the socket due to ListenerManagerImpl::maybeCloseSocketsForListener as well as ActiveRawUdpListener::shutdownListener.

    The child's listener starts reading only after HotRestartingChild::allDrainsImplicitlyComplete, i.e. at parent terminate, so between drain start and --parent-shutdown-time-s nobody reads the socket at all.

    Not closing the sockets for connectionless UDP listeners and not calling the shutdownListener cleanup during hotrestart removes the gap during which no UDP packets are read, which causes both "established" and new UDP flows to go to the old epoch. Routing new flows to the new instance via the hot restart RPC is then just a matter of installing the Network::NonDispatchedUdpPacketHandler and maintaining a map of established flows with a timeout after which an entry is removed.

    I'd be happy to turn this into a PR.

  3. ravenblackx commented on Jul 31, 2026

    @ravenblackx
    ContributorAuthor

    Sounds good to me. Not sure how (if at all) udp packets interact with bpf - if they do it might make this slightly more complicated. Can't really make it worse though!

  4. filipcacky commented on Jul 31, 2026

    @filipcacky
    Contributor

    UDP packets don't interact with BPF here, raw UDP listeners have no BPF program attached.

    Default reuseport kernel behaviour picks the socket by 4tuple hash index into the reuseport group (QUIC can't use that since clients can migrate IPs, hence the cBPF program which routes based on CID overriding it). Hot restart / LDS duplicates the parent's sockets, so the reuseport group stays the same.

    We could skip the RPC with an eBPF program explicitly mapping 4tuple->socket, and having the new instance create new sockets instead of duplicating, but thats out of scope for now.

  5. added a commit that references this issue on Sep 9, 2026
    712586a
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

    area/hot_restartarea/udpenhancementhelp wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions