[Interest] Is QProcess really reentrant?

Bill Crocker william.crocker at analog.com
Wed Jul 24 03:58:03 CEST 2013


Dear Qt Enthusiasts:

Below is the stack trace from a crash of an MT Qt app of mine.
This is a one in a million event so I can not provide a reproducible test case.
Multiple threads were running and several of them were using local QProcess 
instances
to query information from the OS while most were just waiting for a lock.
Sorry this is so long.
I am using 4.7.1

Any ideas. Thanks.

Bill
---------------------

(gdb) info thread
   10 Thread 14450  0xffffe410 in __kernel_vsyscall ()
   9 Thread 14451  0x08ab9408 in QMutex::lock() ()
   8 Thread 22900  0xffffe410 in __kernel_vsyscall ()
   7 Thread 22901  0xffffe410 in __kernel_vsyscall ()
   6 Thread 22905  0xffffe410 in __kernel_vsyscall ()
   5 Thread 22907  0x00956e21 in fork () from /lib/libc.so.6
   4 Thread 22908  0xffffe410 in __kernel_vsyscall ()
   3 Thread 22909  0xffffe410 in __kernel_vsyscall ()
   2 Thread 22910  0xffffe410 in __kernel_vsyscall ()
* 1 Thread 22906  0x08bae58e in QObjectPrivate::QObjectPrivate(int) ()

(gdb) thread 1
[Switching to thread 1 (Thread 22906)]#0  0x08bae58e in 
QObjectPrivate::QObjectPrivate(int) ()
(gdb) where
#0  0x08bae58e in QObjectPrivate::QObjectPrivate(int) ()
#1  0x08bae890 in QObject::QObject(QObject*) ()
#2  0x08bb49ff in QSocketNotifier::QSocketNotifier(int, QSocketNotifier::Type, 
QObject*) ()
#3  0x08b7d720 in QProcessPrivate::createChannel(QProcessPrivate::Channel&) ()
#4  0x08b7db4a in QProcessPrivate::startProcess() ()
#5  0x08b3d922 in QProcess::start(QString const&, QStringList const&, 
QFlags<QIODevice::OpenModeFlag>) ()
#6  0x081058ce in GetDirectorySpace(QString, QString, int*, int*) ()
#7  0x08297893 in GetDirectorySpaceThread::run() ()
#8  0x08abd9af in QThreadPrivate::start(void*) ()
#9  0x00a2c832 in start_thread () from /lib/libpthread.so.0
#10 0x009970ae in clone () from /lib/libc.so.6

(gdb) thread 2
[Switching to thread 2 (Thread 22910)]#0  0xffffe410 in __kernel_vsyscall ()
(gdb) where
#0  0xffffe410 in __kernel_vsyscall ()
#1  0x009a3a23 in __lll_lock_wait_private () from /lib/libc.so.6
#2  0x0093309e in _L_lock_15034 () from /lib/libc.so.6
#3  0x00931bf8 in malloc_atfork () from /lib/libc.so.6
#4  0x009310d7 in malloc () from /lib/libc.so.6
#5  0x00b7caf7 in operator new(unsigned int) () from /usr/lib/libstdc++.so.6
#6  0x08abd006 in QThreadPrivate::createEventDispatcher(QThreadData*) ()
#7  0x08abd986 in QThreadPrivate::start(void*) ()
#8  0x00a2c832 in start_thread () from /lib/libpthread.so.0
#9  0x009970ae in clone () from /lib/libc.so.6

(gdb) thread 3
[Switching to thread 3 (Thread 22909)]#0  0xffffe410 in __kernel_vsyscall ()
(gdb) where
#0  0xffffe410 in __kernel_vsyscall ()
#1  0x009a3a23 in __lll_lock_wait_private () from /lib/libc.so.6
#2  0x0093309e in _L_lock_15034 () from /lib/libc.so.6
#3  0x00931bf8 in malloc_atfork () from /lib/libc.so.6
#4  0x009310d7 in malloc () from /lib/libc.so.6
#5  0x00b7caf7 in operator new(unsigned int) () from /usr/lib/libstdc++.so.6
#6  0x08abd006 in QThreadPrivate::createEventDispatcher(QThreadData*) ()
#7  0x08abd986 in QThreadPrivate::start(void*) ()
#8  0x00a2c832 in start_thread () from /lib/libpthread.so.0
#9  0x009970ae in clone () from /lib/libc.so.6

(gdb) thread 4
[Switching to thread 4 (Thread 22908)]#0  0xffffe410 in __kernel_vsyscall ()
(gdb) where
#0  0xffffe410 in __kernel_vsyscall ()
#1  0x009a3a23 in __lll_lock_wait_private () from /lib/libc.so.6
#2  0x0093309e in _L_lock_15034 () from /lib/libc.so.6
#3  0x00931bf8 in malloc_atfork () from /lib/libc.so.6
#4  0x009310d7 in malloc () from /lib/libc.so.6
#5  0x00b7caf7 in operator new(unsigned int) () from /usr/lib/libstdc++.so.6
#6  0x08abd006 in QThreadPrivate::createEventDispatcher(QThreadData*) ()
#7  0x08abd986 in QThreadPrivate::start(void*) ()
#8  0x00a2c832 in start_thread () from /lib/libpthread.so.0
#9  0x009970ae in clone () from /lib/libc.so.6

(gdb) thread 5
[Switching to thread 5 (Thread 22907)]#0  0x00956e21 in fork () from /lib/libc.so.6
(gdb) where
#0  0x00956e21 in fork () from /lib/libc.so.6
#1  0x00a36114 in fork () from /lib/libpthread.so.0
#2  0x08b7dff5 in QProcessPrivate::startProcess() ()
#3  0x08b3d922 in QProcess::start(QString const&, QStringList const&, 
QFlags<QIODevice::OpenModeFlag>) ()
#4  0x08105328 in GetSwap(int*, int*) ()
#5  0x0829784b in GetSwapThread::run() ()
#6  0x08abd9af in QThreadPrivate::start(void*) ()
#7  0x00a2c832 in start_thread () from /lib/libpthread.so.0
#8  0x009970ae in clone () from /lib/libc.so.6

(gdb) thread 6
[Switching to thread 6 (Thread 22905)]#0  0xffffe410 in __kernel_vsyscall ()
(gdb) where
#0  0xffffe410 in __kernel_vsyscall ()
#1  0x009a3a23 in __lll_lock_wait_private () from /lib/libc.so.6
#2  0x0093309e in _L_lock_15034 () from /lib/libc.so.6
#3  0x00931bf8 in malloc_atfork () from /lib/libc.so.6
#4  0x009310d7 in malloc () from /lib/libc.so.6
#5  0x00b7caf7 in operator new(unsigned int) () from /usr/lib/libstdc++.so.6
#6  0x08bab6d6 in QObject::deleteLater() ()
#7  0x08b7ba19 in QProcessPrivate::processStarted() ()
#8  0x08b389b2 in QProcessPrivate::_q_startupNotification() ()
#9  0x08b7a513 in QProcessPrivate::waitForStarted(int) ()
#10 0x08b3818f in QProcess::waitForStarted(int) ()
#11 0x08102a49 in RunToFinish(QProcess*, int, int, int) ()
#12 0x0810595b in GetDirectorySpace(QString, QString, int*, int*) ()
#13 0x08297893 in GetDirectorySpaceThread::run() ()
#14 0x08abd9af in QThreadPrivate::start(void*) ()
#15 0x00a2c832 in start_thread () from /lib/libpthread.so.0
#16 0x009970ae in clone () from /lib/libc.so.6

(gdb) thread 7
[Switching to thread 7 (Thread 22901)]#0  0xffffe410 in __kernel_vsyscall ()
(gdb) where
#0  0xffffe410 in __kernel_vsyscall ()
#1  0x009a3a23 in __lll_lock_wait_private () from /lib/libc.so.6
#2  0x0093309e in _L_lock_15034 () from /lib/libc.so.6
#3  0x00931bf8 in malloc_atfork () from /lib/libc.so.6
#4  0x009310d7 in malloc () from /lib/libc.so.6
#5  0x00b7caf7 in operator new(unsigned int) () from /usr/lib/libstdc++.so.6
#6  0x08bab6d6 in QObject::deleteLater() ()
#7  0x08b7ba19 in QProcessPrivate::processStarted() ()
#8  0x08b389b2 in QProcessPrivate::_q_startupNotification() ()
#9  0x08b7a513 in QProcessPrivate::waitForStarted(int) ()
#10 0x08b3818f in QProcess::waitForStarted(int) ()
#11 0x08102a49 in RunToFinish(QProcess*, int, int, int) ()
#12 0x08104e29 in GetActivity(int*, int*, int*) ()
#13 0x08297802 in GetActivityThread::run() ()
#14 0x08abd9af in QThreadPrivate::start(void*) ()
#15 0x00a2c832 in start_thread () from /lib/libpthread.so.0
#16 0x009970ae in clone () from /lib/libc.so.6

(gdb) thread 8
[Switching to thread 8 (Thread 22900)]#0  0xffffe410 in __kernel_vsyscall ()
(gdb) where
#0  0xffffe410 in __kernel_vsyscall ()
#1  0x00a30bc5 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/libpthread.so.0
#2  0x08abe152 in QWaitCondition::wait(QMutex*, unsigned long) ()
#3  0x08abd23f in QThread::wait(unsigned long) ()
#4  0x08109756 in LoadReportThread::collectLoadData() ()
#5  0x08110a8e in LoadReportThread::run() ()
#6  0x08abd9af in QThreadPrivate::start(void*) ()
#7  0x00a2c832 in start_thread () from /lib/libpthread.so.0
#8  0x009970ae in clone () from /lib/libc.so.6

(gdb) thread 9
[Switching to thread 9 (Thread 14451)]#0  0x08ab9408 in QMutex::lock() ()
(gdb) where
#0  0x08ab9408 in QMutex::lock() ()
#1  0x08b7b24b in QProcessManager::catchDeadChildren() ()
#2  0x08b7b413 in QProcessManager::run() ()
#3  0x08abd9af in QThreadPrivate::start(void*) ()
#4  0x00a2c832 in start_thread () from /lib/libpthread.so.0
#5  0x009970ae in clone () from /lib/libc.so.6

(gdb) thread 10
[Switching to thread 10 (Thread 14450)]#0  0xffffe410 in __kernel_vsyscall ()
(gdb) where
#0  0xffffe410 in __kernel_vsyscall ()
#1  0x0098fc71 in select () from /lib/libc.so.6
#2  0x08bc1b74 in qt_safe_select(int, fd_set*, fd_set*, fd_set*, timeval const*) ()
#3  0x08bc2479 in QEventDispatcherUNIX::select(int, fd_set*, fd_set*, fd_set*, 
timeval*) ()
#4  0x08bc2c73 in 
QEventDispatcherUNIXPrivate::doSelect(QFlags<QEventLoop::ProcessEventsFlag>, 
timeval*) ()
#5  0x08bc3bb1 in 
QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) ()
#6  0x08b98c0a in 
QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) ()
#7  0x08b99092 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) ()
#8  0x08b9cdd5 in QCoreApplication::exec() ()
#9  0x08238e0d in DoBCommd(int, char**) ()




More information about the Interest mailing list