Forum OpenACS Q&A: Re: Killing aolserver thread (linux)

Collapse
Posted by Andrew Piskorski on
No, you cannot kill threads, you can only ask the thread to exit. If the thread is in an infinite loop and thus paying no attention, you're stuck. This is generally a limitation of the underlying POSIX thread libraries.

Now, it might be possible to somehow use the Tcl event loop to say, "Heh Tcl interpreter, stop that crap you're doing, execute this nice clean thread shutdown command right now!" But that's just a vague guess, I've never looked into it.

On any modern machine, it should not take "a minute or two" for an OpenACS AOLserver to come back up, and if it is, it should be fixable.

Hm, if you tell Linux to kill the process id for that thread, I'm not really sure what would happen. I'm 989 certain it will be a Bad Thing, most likely the whole process will just die. It'd be worth trying sometime (on a testing server of course).

Collapse
Posted by Andrew Piskorski on
Incidentally, the reason the Linux kernel assigns a separate "Process ID" to each thread is because inside the kernal, they're scheduled the same (the 1:1 thread model). And in fact, from what I've read the kernel does not have a binary distinction between "processes" and "threads", but rather a much more flexible continuum between the two - not just "shared nothing" processes and "shared everything" threads, but various types of "shared this but not that" in between. Perhaps they use that internally in the kernel, but you won't see it in any user-level threading libraries anytime soon, because unlike POSIX processes and threads, those features are strictly Linux-specific.