Error sending UDP message: No buffer space available, not reproducible with truss

From: Rodrigo Osorio <rodrigo_at_FreeBSD.org>
Date: Sat, 10 Jan 2026 17:18:20 UTC
Hi,

I have this strange behavior with an application I ported a couple of 
weeks ago
multimedia/tsduck which can broadcast MPEG transport streams over UDP.

When I run the application as a regular user :

tsp -O ip 239.1.0.38:11112  -I file media.ts I got an error on the 
sendto() call

"No buffer space available"

When trying to analize the issue with ktrace or truss, sudenly I got no 
errors and
the application just works.

  5798: socket(PF_INET,SOCK_DGRAM,IPPROTO_UDP)    = 6 (0x6)
  5798: setsockopt(6,IPPROTO_IP,IP_RECVDSTADDR,0x8205160a4,4) = 0 (0x0)
  5798: bind(6,{ AF_INET 0.0.0.0:0 },16)      = 0 (0x0)
  5798: getsockname(6,{ AF_INET 0.0.0.0:63851 },0x820515ef4) = 0 (0x0)
  5798: setsockopt(6,IPPROTO_IP,IP_MULTICAST_LOOP,0x820516088,1) = 0 (0x0)

[...]

  5798: sendto(6,"G@\0\^Q\0\0\M-0\r\0\^B\M-A\0\0\0"...,1316,0,{ AF_INET 
239.1.0.38:11112 },16) = 1316 (0x524)

Since the two calls are performed (without and with truss) are performed 
without any change, I wonder
what can explain this behavior. calling the application again without 
truss leads to the same buffer error.

Here is the full trace using truss: 
https://people.freebsd.org/~rodrigo/tsduck_no_buffer_space.txt

Thanks in advance for your help.

-- rodrigo