-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
Description
I ran into an issue with a UDP socket where a single task sequentially reads from and writes to a blocking, no timeout UDP socket.
CONFIG_NET_RECV_BUFSIZE was 0, so the only place where the UDP readahead IOB buffers get freed is in recvfrom. If the IOB free list got emptied before the sendto() call, that call would block indefinitely waiting for memory, never giving the recvfrom() a chance to produce IOB buffers.
From its description in kconfig, I got the impression that CONFIG_IOB_THROTTLE was specifically created to prevent this kind of deadlock (although it only speaks of TCP, it's also used in the UDP code).
On inspecting the UDP stack, if CONFIG_IOB_THROTTLE is enabled, the UDP reception allocates with throttle=true as expected. However the send logic of both TCP and UDP also allocate throttled instead of unthrottled, contradicting the IOB_THROTTLE description and thus not solving my issue. udp_wrbuffer_alloc however DOES alloc unthrottled but appears to never get called.
I am not directly in control of the code which sequentially sendto()/recvfrom()s the socket to fix the behaviour by e.g. moving them to separate tasks. My question is whether this IOB_THROTTLE behaviour is a bug, or whether there's another intended (config) solution.
Verification
- I have verified before submitting the report.