[Interest] QProcess::execute never returning (5.4/5.5 behaviour change)

Alejandro Exojo suy at badopi.org
Sun Jul 26 19:11:55 CEST 2015


Hi.

I have one application on Mac with one line like the following:

result = QProcess::execute("/sbin/umount", QStringList() << m_mountedPath);

That stopped working one day, and I could not figure out why. The process is 
executed and runs successfully (I can see it unmounts), but it never returns 
to the caller.

I thought it was something I changed elsewhere, but no. After recompiling with 
5.5.0 (upgrading from 5.4.2) it worked again... partially (explained below). I 
think now that it stopped working when I upgraded to 5.4.2 from 5.4.1.

This works perfectly fine in a test case that just calls execute(), so I think 
the issue is that I'm using the FUSE library. That library calls fork and 
exec, and at some point sets up SIGCHLD in a way that probably prevents 
QProcess from working well (it uses signal instead of sigaction), even if I 
use it in a different thread.

That's the part that works partially as wanted with 5.5.0. I call fuse_mount 
(which is the one I suspect it breaks something) at application startup, and 
the first call to QProces::execute() works. If I call fuse_mount again, the 
second call to execute() works, but never returns to the caller.

So, is this a QProcess limitation or a bug? I see the behaviour change across 
versions. Might be that the other library is doing something plain 
unnacceptable for QProcess? I tried replacing QProces::execute() with 
::system() and it works as expected, though.

Thank you.

PD: And thank you Thiago for your blog posts about forkfd. Reading that 
probably was the key that made me figure out what might be wrong with my app. 
Otherwise I would still be hitting my head against the desk. :)

-- 
Alex (a.k.a. suy) | GPG ID 0x0B8B0BC2
http://barnacity.net/ | http://disperso.net



More information about the Interest mailing list