SIGCHLD and sockets

Keith Bottner kbottner at barkinglizards.com
Mon Apr 3 20:28:29 UTC 2006


I am having a problem with SIGCHLD signals and their interaction with
sockets.
 
I have an application that forks modules in separate processes and use UNIX
domain sockets for communication. The main application handles the SIGCHLD
signal so that it can detect when/if a module crashes and if so restart that
specific module. The problem arises when the module crashes and before the
main application is notified with the SIGCHLD signal the socket will
continue to allow writes. I expected that there would be occasions when the
SIGCHLD signal would occur after my attempt to write into the socket, but I
also expected the socket to return an error at which point I could then mark
the module for restart as well.
 
My question is, has anybody else had this problem? Does anybody know exactly
what is going on an why? And most importantly, does anybody have a solution?
 
Thanks in advance for your time, it is quite an interesting problem so I am
hoping to get some insightful answers.
 
Keith


More information about the freebsd-questions mailing list