I am testing my code on a cheap Digital Ocean droplet (2GB ram, but I also tried adding 4GB of swap and it didn't change anything).
A part of my program has many UDP client DGRAM sockets open to various local ports (from/to 127.0.0.1).
Sometimes, without an insane amount of data being sent, the send()
call fails with No buffer space available
(error 105).
My program then tries to use all other sockets available (to other local ports) but they all fail at the same time.
I have set /proc/sys/net/core/wmem_max
(and /proc/sys/net/core/rmem_max
) to 16MB, and each of these sockets has setsockopt SOL_SOCKET, SO_SNDBUF
set to 8MB. None of these change anything.
How can send()
fail with No buffer space available
? Isn't this supposed to only happen when we send() too quickly? But here this is local and I don't send a lot of data.
What puzzles me the most is that when the process retries any another socket it gets the same error. Aren't sockets buffers supposed to be completely independent?
What are the possible causes?