Guido van Rossum added the comment:

I'm a little closer to understanding the first (more common) traceback. I can 
repro it by running your demo program in a loop -- it may take a while but 
occasionally I do get the same InvalidStateError.

This appears to be an example of the problem speculated about in message #5 of 
https://code.google.com/p/tulip/issues/detail?id=58.

In order to find out which occurrence of call_later(future.set_result, None) is 
causing this, I replaced all of them (about half a dozen) with an equivalent 
lambda -- the lambda shows up in the traceback, unlike the location where 
call_soon() is called.

In this particular example, it is the last line of 
_SelectorSocketTransport.__init__() in selector_events.py (line 446).

I suspect there are other places where a similar problem can occur.  I still 
have to think more about how to fix this (without changing set_result() to 
always ignore a cancelled Future -- such a change would mask certain errors 
that I find important to catch).

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue21447>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to