Hello,

I have an odd problem with QtService (http://qt.gitorious.org/qt-solutions) on Linux (Debian stable):

When starting my daemon during boot (via init script), the process receives a segfault in QMutex::unlock. This seems to happen *after* the background process is forked, since the service process is actually running once booting is completed.

I can not reproduce this by (re-) starting the service once the system is up, it happens only during boot. Also the segfault does not happen on every boot, but only about 80% of the time, so it seems to be a race condition.

The crash also happens when I remove all of my service implementation except for minimal skeleton code, so I'm pretty sure this problem is not a side effect of my code.

Qt Code:
  1. Program terminated with signal 11, Segmentation fault.
  2. #0 0xb7209c6c in QMutex::unlock (this=0x9a07f88) at /home/build/dev/qt-everywhere-opensource-src-4.7.4/src/corelib/thread/qmutex.cpp:370
  3. 370 "A mutex must be unlocked in the same thread that locked it.");
To copy to clipboard, switch view to plain text mode 

Backtrace:
Qt Code:
  1. Thread 2 (Thread 936):
  2. #0 0xb7800424 in __kernel_vsyscall ()
  3. #1 0xb717ffcf in __pthread_cond_wait (cond=0x9a07f48, mutex=0x9a07f30) at pthread_cond_wait.c:153
  4. #2 0xb72119fb in QWaitConditionPrivate::wait (this=0x9a07f30, time=4294967295)
  5. at /home/build/dev/qt-everywhere-opensource-src-4.7.4/src/corelib/thread/qwaitcondition_unix.cpp:88
  6. #3 0xb72117ff in QWaitCondition::wait (this=0x9a09b88, mutex=0x9a09b70, time=4294967295)
  7. at /home/build/dev/qt-everywhere-opensource-src-4.7.4/src/corelib/thread/qwaitcondition_unix.cpp:160
  8. #4 0xb7210fa3 in QThread::wait (this=0xb74b3794, time=4294967295)
  9. at /home/build/dev/qt-everywhere-opensource-src-4.7.4/src/corelib/thread/qthread_unix.cpp:745
  10. #5 0xb730349d in ~QProcessManager (this=0xb74b3794, __in_chrg=<value optimized out>)
  11. at /home/build/dev/qt-everywhere-opensource-src-4.7.4/src/corelib/io/qprocess_unix.cpp:208
  12. #6 0xb6f242df in __run_exit_handlers (status=0, listp=0xb7038304, run_list_atexit=true) at exit.c:78
  13. #7 0xb6f2434f in *__GI_exit (status=0) at exit.c:100
  14. #8 0xb6f0bcae in __libc_start_main (main=0x80520c4 <main>, argc=1, ubp_av=0xbfa8c674, init=0x8075480 <__libc_csu_init>, fini=0x8075470 <__libc_csu_fini>,
  15. rtld_fini=0xb780f380 <_dl_fini>, stack_end=0xbfa8c66c) at libc-start.c:260
  16. #9 0x08052031 in _start ()
  17.  
  18. Thread 1 (Thread 974):
  19. #0 0xb7209c6c in QMutex::unlock (this=0x9a07f88) at /home/build/dev/qt-everywhere-opensource-src-4.7.4/src/corelib/thread/qmutex.cpp:370
  20. #1 0xb71ed78a in QMutexLocker::unlock (this=0xb68b6250) at ../../include/QtCore/../../../qt-everywhere-opensource-src-4.7.4/src/corelib/thread/qmutex.h:114
  21. #2 0xb71ed747 in ~QMutexLocker (this=0xb68b6250, __in_chrg=<value optimized out>)
  22. at ../../include/QtCore/../../../qt-everywhere-opensource-src-4.7.4/src/corelib/thread/qmutex.h:108
  23. #3 0xb73669f1 in QEventDispatcherGlibPrivate (this=0x9a09fa8, context=0x0)
  24. at /home/build/dev/qt-everywhere-opensource-src-4.7.4/src/corelib/kernel/qeventdispatcher_glib.cpp:299
  25. #4 0xb7366da2 in QEventDispatcherGlib (this=0x9a09b10, parent=0x0)
  26. at /home/build/dev/qt-everywhere-opensource-src-4.7.4/src/corelib/kernel/qeventdispatcher_glib.cpp:357
  27. #5 0xb7210390 in QThreadPrivate::createEventDispatcher (data=0x9a09c20)
  28. at /home/build/dev/qt-everywhere-opensource-src-4.7.4/src/corelib/thread/qthread_unix.cpp:272
  29. #6 0xb72104d9 in QThreadPrivate::start (arg=0xb74b3794) at /home/build/dev/qt-everywhere-opensource-src-4.7.4/src/corelib/thread/qthread_unix.cpp:324
  30. #7 0xb717b955 in start_thread (arg=0xb68b6b70) at pthread_create.c:300
  31. #8 0xb6fc158e in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130
To copy to clipboard, switch view to plain text mode 

Does anyone have an idea what the problem might be?

Also, is there some kind of community support (bug tracker, discussion forum/list) for QtService/Qt-Solutions?