Re: [python-tulip] Orphaned coroutines running in Dummy thread?

2014-04-07 Thread Guido van Rossum
I can't really help you because I don't know aiohttp, but I note that you have way too much code manipulating a main loop. I see three separate loop.run_*() calls and a loop.stop() call that smells funny (because it's called before the loop is even started). A better idiom would be to put all this

Re: [python-tulip] Orphaned coroutines running in Dummy thread?

2014-04-07 Thread Lars Andersson
Thanks Guido. All that mess manipulating the loop is the hoops I've had to jump through to get the server to shut down without causing ResourceWarnings about open sockets etc. I'll ask the aiohttp developers about a better way for the http server to shut itself down... Still, is it possible th

Re: [python-tulip] Orphaned coroutines running in Dummy thread?

2014-04-07 Thread Guido van Rossum
Code in one frame does not switch threads. However if you have loops on different threads and schedule events between those that might happen (the latest upstream Tulip has a guard agains this). According to threading.py, Dummy threads are used to represent threads not started by that module (but e

Re: [python-tulip] Orphaned coroutines running in Dummy thread?

2014-04-07 Thread Lars Andersson
Ok, I've managed to reproduce the "Dummy" thread weirdness without aiohttp... see attached code. When running this using python 3.4 and upstream asyncio (as of April 7) on an ubuntu 12.04 machine, I get the following output: MainThread(140470366000896): Main Enter Thread-1(140470315005696): Th

Re: [python-tulip] Orphaned coroutines running in Dummy thread?

2014-04-07 Thread Guido van Rossum
Aha. It must be that the Thread object is already gone, but gc runs a finally clause. On Monday, April 7, 2014, Lars Andersson wrote: > > Ok, I've managed to reproduce the "Dummy" thread weirdness without > aiohttp... see attached code. When running this using python 3.4 and > upstream asyncio (

Re: [python-tulip] Orphaned coroutines running in Dummy thread?

2014-04-07 Thread Lars Andersson
Nothing to worry about then I guess? Den tisdagen den 8:e april 2014 kl. 12:03:28 UTC+10 skrev Guido van Rossum: > > Aha. It must be that the Thread object is already gone, but gc runs a > finally clause. > > On Monday, April 7, 2014, Lars Andersson > > wrote: > >> >> Ok, I've managed to reprod

Re: [python-tulip] Orphaned coroutines running in Dummy thread?

2014-04-07 Thread Guido van Rossum
Not that bit, no. On Mon, Apr 7, 2014 at 7:05 PM, Lars Andersson wrote: > Nothing to worry about then I guess? > > > Den tisdagen den 8:e april 2014 kl. 12:03:28 UTC+10 skrev Guido van Rossum: >> >> Aha. It must be that the Thread object is already gone, but gc runs a >> finally clause. >> >> O