I have two processes – parent and child. The parent establishes the socket pair and it gets passed to the child as part of fork.
The parent then accepts for a connection and passes every new socket fd for the child to process. This is done via sendmsg. This works fine when the rate of incoming connections is around 10 per second. However, after it increases to 200 per second, I keep on getting message sendmsg: No buffer space available.
What can be the reason for this? And what should I check for?
Here is what I have thought so far:
I am wondering if like other socket calls, when the child does a recvmsg, it should be removed from the socketpair buffer
The most probable reason is that your child process does not read from the socket fast enough, so the parent overflows in-kernel buffers, but hard to say without seeing the code.
Have you considered sending multiple file descriptors in one
cmsg(3)?