Issues with fork and dbus_server_disconnect when using unix domain sockets

John Palmieri johnp at redhat.com
Wed Nov 19 12:24:30 PST 2008


One of the Red Hat engineers is having an issue with the d-bus server api deleting the socket file when disconnecting after a fork (note he wishes to avoid fork and exec or threads which would route around this issue).  Basically he has a main process which opens up a d-bus server socket to listen for requests.  On each request he forks a child process to handle the request and needs to close the socket so that the child does not try to process requests itself, however in socket_disconnect in the file dbus-server-socket.c we unlink the file.  I notice there is the api _dbus_server_socket_own_filename which if not called will make sure socket_disconnect does not unlink the file.  However, there is no API to specify that I don't want to own the file name when creating a server.  I'm not sure what the best fix is here.  I think adding API to specify that the parent program will take care of cleaning up files on disk is the least invasive fix.
 
--
John (J5) Palmieri
Software Engineer
Red Hat, Inc.


More information about the dbus mailing list