Not our bug. Recorded here so it is not lost. Do not file upstream without checking with Phil.
include/zephyr/net/dns_resolve.h:220-225:
#define DNS_DISPATCHER_MAX_POLL (DNS_RESOLVER_MAX_POLL + MDNS_MAX_POLL + LLMNR_MAX_POLL)
#if defined(CONFIG_ZVFS_POLL_MAX)
BUILD_ASSERT(CONFIG_ZVFS_POLL_MAX >= DNS_DISPATCHER_MAX_POLL,
"CONFIG_ZVFS_POLL_MAX must be larger than " STRINGIFY(DNS_DISPATCHER_MAX_POLL));
#endif
The runtime bound is one higher. sockets_service.c reserves ctx.events[0] for its own
eventfd and polls count + 1 entries, so the check at line 208 is
if ((count + 1) > ARRAY_SIZE(ctx.events)). When it fires the thread jumps to fail:, sets
SOCKET_SERVICE_THREAD_FAILED and returns, and sockets registered with the service are never
read. Both NET_ERRs explaining it are compiled out at the common NET_SOCKETS_LOG_LEVEL=0.
The stock configuration lands exactly on the boundary. DNS_RESOLVER=y plus
MDNS_RESPONDER=y, IPv4 and IPv6, one interface, DNS_RESOLVER_MAX_SERVERS=1 gives
DNS_DISPATCHER_MAX_POLL = 1 + 2 + 0 = 3, and ZVFS_POLL_MAX defaults to 3. The assert
passes on 3 >= 3 and the thread dies at runtime. Either feature alone is fine.
Fix is one character:
BUILD_ASSERT(CONFIG_ZVFS_POLL_MAX > DNS_DISPATCHER_MAX_POLL,
Even then the assert counts only the DNS services, while any other NET_SOCKET_SERVICE_*_DEFINE
in the image adds to the same array. The real invariant is the total across all registered
services plus one.
Not our bug. Recorded here so it is not lost. Do not file upstream without checking with Phil.
include/zephyr/net/dns_resolve.h:220-225:The runtime bound is one higher.
sockets_service.creservesctx.events[0]for its owneventfd and polls
count + 1entries, so the check at line 208 isif ((count + 1) > ARRAY_SIZE(ctx.events)). When it fires the thread jumps tofail:, setsSOCKET_SERVICE_THREAD_FAILEDand returns, and sockets registered with the service are neverread. Both NET_ERRs explaining it are compiled out at the common
NET_SOCKETS_LOG_LEVEL=0.The stock configuration lands exactly on the boundary.
DNS_RESOLVER=yplusMDNS_RESPONDER=y, IPv4 and IPv6, one interface,DNS_RESOLVER_MAX_SERVERS=1givesDNS_DISPATCHER_MAX_POLL= 1 + 2 + 0 = 3, andZVFS_POLL_MAXdefaults to 3. The assertpasses on
3 >= 3and the thread dies at runtime. Either feature alone is fine.Fix is one character:
Even then the assert counts only the DNS services, while any other
NET_SOCKET_SERVICE_*_DEFINEin the image adds to the same array. The real invariant is the total across all registered
services plus one.