[PyQt] deadlock when using new style signal / slots

Hans-Peter Jansen hpj at urpla.net
Tue Sep 7 00:02:15 BST 2010


On Tuesday 07 September 2010, 00:01:55 Erik Janssens wrote:
> Hello Pete,
>
> it might indeed be that the deadlock is not directly
> related to the new style signal slot, since the deadlock
> might become visible due to a slight timing difference
> cause by eg switching to new style signal slots.
>
> however I wonder wether I'm doing anything wrong by
> connecting and emiting the same signal object at the
> same time (I did experiment with the connection type,
> but without result).

Hmm, that's a pity.

> For now I have put a mutexlock around 
> this particular instance, but I wonder if I should mutex
> all possible cases ??

Did you searched for well known Qt issues of this kind already? 

Anyway, I would start to create a test script. That way, Phil might take a 
deeper look inside, since this problem combines a _somewhat_ hairy area 
(threads in general) with a complex PyQt one (dynamic "mocing" with 
signals/slots). Therefore my usual advise to look into the sip/PyQt/Qt 
source is exceptionally hard to follow in this case.

> The camelot website (www.python-camelot.com) should be
> up and running, I was not aware of any downtime, it's
> hosted at weebly.com.

Hmm:
$ LANG=C wget www.python-camelot.com
--2010-09-07 00:21:40--  http://www.python-camelot.com/
Resolving www.python-camelot.com... 199.34.228.100
Connecting to www.python-camelot.com|199.34.228.100|:80... failed: 
Connection timed out.
Retrying.

--2010-09-07 00:24:50--  (try: 2)  http://www.python-camelot.com/
Connecting to www.python-camelot.com|199.34.228.100|:80... failed: 
Connection timed out.
Retrying.

--2010-09-07 00:28:01--  (try: 3)  http://www.python-camelot.com/
Connecting to www.python-camelot.com|199.34.228.100|:80... failed: 
Connection timed out.
Retrying.


> The project is going well, we've 
> put a lot of work in switching from MDI to tab based and
> are now converting to new style signal/slots because we
> noticed stability improvements by using them.  These
> deadlocks are of course bothering me.

Sounds nice. Is there any VCS I can pull from?

Best regards,
Pete

> Best regards,
>
> Erik
>
> On Mon, 2010-09-06 at 10:43 +0200, Hans-Peter Jansen wrote:
> > Dear Erik,
> >
> > On Friday 27 August 2010, 21:56:14 Erik Janssens wrote:
> > > Hi,
> > >
> > > Another issue popped up when porting our code to
> > > new style signal slots.
> > >
> > > it appears the deadlock occurs when one thread is
> > > emitting using a pyqtSignal object, while another
> > > thread is connecting the same pyqtSignal object to
> > > a slot,
> >
> > I don't believe, that this is _directly_ related to the new style
> > signal/slot idiom, but you might want to experiment with the connection
> > type argument of connect.
> >
> > > this is the pseudocode for the connection :
> > >
> > > class(...):
> > >
> > >     def __init__(...):
> > >       self.rsh.entity_update_signal.connect(
> > > self.handle_entity_update )
> > >
> > >     @QtCore.pyqtSlot( object, object )
> > >     def handle_entity_update( self, sender, entity ):
> > >         ...
> > >
> > > Are these operations supposed to be thread safe or am
> > > I missing something ?
> >
> > BTW, the camelot website http://www.python-camelot.com/ seems to be
> > down since some time.. What's the state of your project?
> >
> > Best regards,
> > Pete
>
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt




More information about the PyQt mailing list