[vbox-dev] Bug in VBoxXPCOM.so: SIGCHLD handler not overridden properly

Florian Vichot florian.vichot at diateam.net
Mon Sep 28 17:20:59 GMT 2009


Hello,

I've been using the virtualbox libvirt driver in my app lately, and I've
noticed a very annoying behaviour: as soon as I initialize the vbox
driver in libvirt, it loads dynamically a bunch of libraries, amongst
which VBoxXPCOM.so. This library spawns a VBoxXPCOMIPCD if none already
exists, and overrides the SIGCLHD handler when it does so, probably to
catch the potential crash of the VBoxXPCOMIPCD daemon.

Where it gets ugly is when it overwrites the handler without saving the
previous handler, and so whatever was there before in not executed
anymore. My app uses the Qt4 framework, and I make heavy usage of
QProcess (which is a wrapper around a process) and its waitForFinished()
method. To work that method needs to have a handler installed for
SIGCHLD, and Qt4 does so at the app initialisation.

But as the vbox driver loads its libraries dynamically, those are always
loaded after Qt installed its handler, and thus even though the Qt
handler is well behaved (it saves the previous handler, and executes it
once it's done with it's own code), the VBoxXPCOM.so isn't, and so, my
app freezes every time I make a call to waitForFinished once the vbox
libvirt driver is loaded.

Actually the fact that's in libvirt is irrelevant, any app using the
XPCOM API will encounter the same problem.

I've attached a patch that should solve the problem.

I didn't test it, as whatever version of VirtualBox OSE I got (3.04,
3.0.6, SVN HEAD), they would either not compile (SVN HEAD) or not work
(in 3.04 and 3.06 OSE, I get this error: "###!!! ASSERTION:
ExceptionStub not thread-safe: '_mOwningThread.GetThread() ==
PR_GetCurrentThread()'"), even without the patch.

As the code I'm patching is the XPCOM library from Mozilla, do I need to
file a bug report with them ? If so, could you point me to the proper
bugtracker, I couldn't find it.

Thank you,
Florian

-------------- next part --------------
A non-text attachment was scrubbed...
Name: vbox_xpcom.patch
Type: text/x-diff
Size: 999 bytes
Desc: not available
URL: <http://www.virtualbox.org/pipermail/vbox-dev/attachments/20090928/1f975f10/attachment.bin>


More information about the vbox-dev mailing list