cms icon indicating copy to clipboard operation
cms copied to clipboard

Make the Worker Python process kill the actual worker thread when exiting

Open lw opened this issue 12 years ago • 3 comments

At the moment when the Worker (i.e. the cmsWorker process) is killed (by Ctrl+C, by RS, etc.), the actual working (where compilation and evaluation happen) thread could remain alive. This needs to be fixed.

Being an ignorant in multi-thread programming in Python, I suggest to see if the daemon=True argument to Thread.__init__ is enough.

lw avatar Feb 23 '13 20:02 lw

Is this the point where the Thread is created? https://github.com/cms-dev/cms/blob/master/cms/async/AsyncLibrary.py#L447

lw avatar Feb 23 '13 21:02 lw

It should.

Anyway, I think that for some reason the fix is not as simple as using daemon, otherwise I would already done it at the time. I remember that I looked a bit at this issue, but later gave up. I don't remember the details.

giomasce avatar Feb 23 '13 21:02 giomasce

BTW, this issue was automatically solved when passing to gevent. However, the Worker still doesn't kill its children (sandboxes, programs being evaluated, ...) when being shut down.

This isn't ususally a problem, since most tasks allow at most a few seconds for evaluated programs. Yet, it would be nice to be sure that no junk is left over.

giomasce avatar Jul 14 '13 12:07 giomasce