[PyQt] PyQt5 thread problems

Erik Botö erik.boto at pelagicore.com
Mon Nov 18 15:00:31 GMT 2013


As usual you find the bug around 5 minutes after you post to a mailing
list. In my case I missed a PyEval_SaveThread(); call at the end of
PyQtQmlPlugin::initializeEngine().

Cheers,
Erik

On Mon, Nov 18, 2013 at 3:31 PM, Erik Botö <erik.boto at pelagicore.com> wrote:
> Hi,
>
> I'm having issues with a thread getting stuck in PyThread_acquire_lock
> () when using it from a Qt Plugin that allows you to load a python
> module that uses PyQt. If I use the same class from python directly it
> works, but I can't see anything wrong in the Qt Plugin code.
>
> I've attached a tarball with files and instruction for reproducing
> this. Any input would be really appreciated. I'm currently using a
> recent snapshot of PyQt.
>
> Some GDB output:
>
> (gdb) info thread
>   Id   Target Id         Frame
>   7    Thread 0x7fffd4969700 (LWP 20911) "QSGRenderThread"
> pthread_cond_wait@@GLIBC_2.3.2 ()
>     at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
>   6    Thread 0x7fffd539d700 (LWP 20910) "qmlscene"
> pthread_cond_wait@@GLIBC_2.3.2 ()
>     at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
>   5    Thread 0x7fffd7fff700 (LWP 20909) "mythreadclass" sem_wait ()
>     at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S:85
>   4    Thread 0x7ffff7e6c700 (LWP 20908) "SignalSender" sem_wait ()
>     at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S:85
>   3    Thread 0x7fffdecdd700 (LWP 20907) "QThread" 0x00007ffff517ff7d in poll ()
>     at ../sysdeps/unix/syscall-template.S:81
>   2    Thread 0x7fffec6ea700 (LWP 20906) "QXcbEventReader"
> 0x00007ffff517ff7d in poll ()
>     at ../sysdeps/unix/syscall-template.S:81
> * 1    Thread 0x7ffff7fca780 (LWP 20905) "qmlscene" 0x00007ffff517ff7d
> in poll ()
>     at ../sysdeps/unix/syscall-template.S:81
> (gdb) thread 5
> [Switching to thread 5 (Thread 0x7fffd7fff700 (LWP 20909))]
> #0  sem_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S:85
> 85 ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S: No such file or directory.
> (gdb) bt
> #0  sem_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S:85
> #1  0x00007ffff7a06598 in PyThread_acquire_lock () from
> /usr/lib/x86_64-linux-gnu/libpython2.7.so
> #2  0x00007ffff7a20616 in PyEval_RestoreThread () from
> /usr/lib/x86_64-linux-gnu/libpython2.7.so
> #3  0x00007ffff7a20a58 in PyGILState_Ensure () from
> /usr/lib/x86_64-linux-gnu/libpython2.7.so
> #4  0x00007fffdda055a7 in ?? () from /usr/lib/python2.7/dist-packages/sip.so
> #5  0x00007fffddda0a27 in sipQThread::run() () from
> /usr/local/lib/python2.7/dist-packages/PyQt5/QtCore.so
> #6  0x00007ffff5aef44f in ?? () from /opt/qt5-5.1.0/lib/libQt5Core.so.5
> #7  0x00007ffff4e7cf6e in start_thread (arg=0x7fffd7fff700) at
> pthread_create.c:311
> #8  0x00007ffff518c9cd in clone () at
> ../sysdeps/unix/sysv/linux/x86_64/clone.S:113
> (gdb)
>
> Best Regards,
> Erik Botö


More information about the PyQt mailing list