SO_REUSEPORT doesn't distribute queries to multiple netmgr workers on MacOS
Jinmei informs us, via Support #17085:
I've recently noticed that, on MacOS 10.15.6, only one netmgr
worker handles incoming queries even if multiple workers are
configured on multiple threads on multiple CPU cores. That's the
case even if I send queries from different addresses or from different
ports to the same listen-on port. It looks like lib/isc/netmgr/udp.c
assumes that SO_REUSEPORT (when available) reasonably distributes
incoming packets to the multiple sockets bound to the same port
with this socket option, but it doesn't work that way at least on
MacOS 10.15 (it's not surprising based on the very original purpose
of SO_REUSEPORT).
I've tested it on MacOS 10.15.6, but I guess it can be common for
other BSD variants that don't have SO_REUSEPORT_LB or other non-Linux,
non-BSD OSes.
He'd like to know whether this is accidental or intended and provides a suggested patch diff if it is not. udp.c.diff
Ondrej: (I've edited the issue to remove "UDP" as the tcp and tcpdns layers have been rewritten to use SO_REUSEPORT_LB
too.)
Edited by Ondřej Surý