[Stackless] crash on exit while daemon thread is still running
Kristján Valur Jónsson
kristjan at ccpgames.com
Fri Feb 1 12:01:41 CET 2013
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.
> -----Original Message-----
> From: stackless-bounces at stackless.com [mailto:stackless-
> bounces at stackless.com] On Behalf Of Y. Sapir
> Sent: 31. janúar 2013 22:48
> To: stackless at stackless.com
> 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:
> def consumer():
> while True:
> def run_tasklet(func, iterations):
> for i in range(iterations):
> thread = threading.Thread(
> args=(producer, 1000000),
> run_tasklet(consumer, 10)
> And here's the stacktrace I get from gdb:
> #0 0xb7e43850 in slp_kill_tasks_with_stacks (ts=ts at entry=0x0) at
> #1 0xb7e4397a in PyStackless_kill_tasks_with_stacks
> (allthreads=allthreads at 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 at entry=2,
> argv=argv at entry=0x804b008) at Modules/main.c:761
> #5 0x080488a2 in main (argc=2, argv=0xbffff174) at ./Modules/python.c:66
> Stackless mailing list
> Stackless at stackless.com
More information about the Stackless