GNOME Bugzilla – Bug 533840
BaconMessageConnection and D-Bus interaction
Last modified: 2008-06-02 21:03:38 UTC
Please describe the problem: I started Empathy, and dbus-daemon was not running. Empathy started dbus-daemon with fork-exec and dbus-daemon, as a child process, was inheriting the Empathy open files. Then Empathy segfaulted (unfortunately I don't have the core), and I restarted Empathy with the right "ulimit -c" setting. But dbus-daemon was still running with the /tmp/empathy.alice.4211518265 socket file opened. And Empathy was blocked. Steps to reproduce: 1. $ ssh -X testaccount@localhost 2. $ empathy 3. crash 4. $ empathy 5. blocked on BaconMessageConnection Actual results: Empathy blocked Expected results: Either print an error or work correctly Does this happen every time? Only tried 1 time Other information: 0x00002ad872c2e3d0 in __connect_nocancel () from /lib/libpthread.so.0 (gdb) bt
+ Trace 198103
$ lsof /tmp/empathy.alice.4211518265 COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME dbus-laun 15179 alice 4u unix 0xffff81000148a3c0 53766 /tmp/empathy.alice.4211518265 dbus-daem 15180 alice 4u unix 0xffff81000148a3c0 53766 /tmp/empathy.alice.4211518265 smcv said: - We can use D-Bus instead of BaconMessageConnection for single-instance. sjoerd said: - The bacon stuff can set FD_CLOEXEC - The dbus autolaunching should be more rigorous with closing fd's when forking
Added Bastien Nocera (the copyright holder of BaconMessageConnection) is CC so he could help on this bug. I don't remember where I copied that module from, could be useful to fix that bug 'upstream' because IIRC that module will be used as basis for the future GUnique?
The code lives in libbacon in SVN. Let me know when you have a patch for review :)
Created attachment 111417 [details] [review] Proposed patch When trying to reproduce I get that: 1) I start empathy 2) bacon-connection creates a socket on /tmp/empathy.test.X 3) dbus-daemon is not running so empathy fork and exec dbus-daemon 4) I kill empathy 5) the socket is still owned by dbus-daemon 6) I restart empathy and it says it's already running so it quits I made a patch to add FD_CLOEXEC flag on conn->fd. It fixes the problem. Bastien > Could you review that patch and tell me if it's OK?
Looks fine to me, please commit to libbacon trunk, applications that have this problem can then update from there.
Done, thanks for the quick review :) This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.
*** Bug 536319 has been marked as a duplicate of this bug. ***