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

Request notifications


Anybody knows if is possible to kill
one aolserver thread without kill the
whole server process?

I am using Linux 2.4.20.


Posted by Rocael Hernández Rizzardini on
what could be the objective of doing this? just curious ..
Posted by Janine Ohmer on
I don't know what Augustin's reason is, but we (furfly) sometimes see a situation where one nsd thread is consuming a lot of CPU cycles while the others appear to be fine.  It would be nice if one could just kill off that thread without having to restart, since it takes a minute or two for the site to come back up. I've been tempted to do this many times but I never have;  it just seems like A Bad Idea (tm).
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).

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.