I put in  "fix" to the repo.
Basically, the code that was killing tasklets on exit never actually worked for 
tasklets from other threads.
Now it will "kill" them, but this is not a synchronous operation and all that 
happens is that when the other threads
get a chance to run, they will get that exception.

I'm not even sure what happens to the currently running foreign tasklet.  It is 
not blocked, merely has yielded the GIL, so it may be that sending it a kill 
message will go unnoticed completely, since we only check the tmpvalue for 
bombs when returning from a switch.

Anyway, stackless doesn't crash now.  2.7 prints a warning on exit, which 
originates in threading.py.  I had to modify the script to make it run on 2.7, 
setting the daemon property on the thread manually and not through the 
initializer.

K

> -----Original Message-----
> From: [email protected] [mailto:stackless-
> [email protected]] On Behalf Of Y. Sapir
> Sent: 31. janúar 2013 22:48
> To: [email protected]
> Subject: [Stackless] crash on exit while daemon thread is still running
> 
> I'm running the 3.3-slp branch on Ubuntu 12.10. The script below gives me a
> segfault. Is this a known problem?
> 
> 
> import threading
> import stackless
> 
> chan = stackless.channel()
> 
> def producer():
>     while True:
>         chan.send(1)
> 
> def consumer():
>     while True:
>         chan.receive()
> 
> def run_tasklet(func, iterations):
>     stackless.tasklet(func)()
>     for i in range(iterations):
>         stackless.run()
> 
> thread = threading.Thread(
>     target=run_tasklet,
>     args=(producer, 1000000),
>     daemon=True)
> thread.start()
> 
> run_tasklet(consumer, 10)
> 
> 
> And here's the stacktrace I get from gdb:
> 
> #0  0xb7e43850 in slp_kill_tasks_with_stacks (ts=ts@entry=0x0) at
> Stackless/core/stacklesseval.c:364
> #1  0xb7e4397a in PyStackless_kill_tasks_with_stacks
> (allthreads=allthreads@entry=1) at Stackless/core/stacklesseval.c:397
> #2  0xb7e70f4a in Py_Finalize () at Python/pythonrun.c:506
> #3  Py_Finalize () at Python/pythonrun.c:485
> #4  0xb7e89e44 in Py_Main (argc=argc@entry=2,
> argv=argv@entry=0x804b008) at Modules/main.c:761
> #5  0x080488a2 in main (argc=2, argv=0xbffff174) at ./Modules/python.c:66
> 
> 
> Thanks.
> 
> _______________________________________________
> Stackless mailing list
> [email protected]
> http://www.stackless.com/mailman/listinfo/stackless



_______________________________________________
Stackless mailing list
[email protected]
http://www.stackless.com/mailman/listinfo/stackless

Reply via email to