in reply to Kill Processes on Pre-Forking Servers
Can you test and if five processes are forked and running fork instead to a sixth special process that only handles killing the requests? I don't have whatever book recipe 17.12 happens to be from :) so I may be completely off base. If the kiddies are pre-forked perhaps you could fork an extra just to have a spare available to kill the request and as part of the IPC from the server pass the number of active children and their tasks. Alternatively you could design the IPC structures to be very explicit about the expectations of how long the process should take or at least when the child should check back in.
To be more specific here what I mean is that as part of the IPC something I like to do is pass to the child a time limit within which I must have a response waiting for me. Basically the parent says "I'm checking back in 20 seconds so be done by then." At that point you could implement an alarm() inside an eval in the client or if you have fairly tight loops in your kiddies, you could regularly check the elapsed time. If the time elapses return to the server either "I'm still busy, when should I check back again?" or "Error! Couldn't finish in X seconds." Er, whatever, you get the idea. You would probably want the parent to check for the childs response within its own set of eval and alarm blocks so that in case of problems the parent won't hang indefinitely waiting for a reply. (I hope you are on a system with a working alarm!)
I guess my point is that carefully structuring the IPC communication might be able to solve your problems. An example (perhaps overly simple) of how I struggled with this is in my Curses Chatterbox Client. This only has one child so the IPC may be much simplier than what you require, but it might give you ideas.
This kind of stuff is exciting to me, so I would love to see some code or hear your ideas on how you attack this (particularly if you win! :) I'd also like to see what 17.12 is so if anyone has a link to that or something like it, I'd be interested. Thanks!
Good luck, and I hope I'm not totally off base here,
Mike
Update:
After reading the other thread (belatedly) that was referenced in your post, I disagree with your comment that you "can't kill the process direct from the web page". The gist of that post is that the owner of a process can kill the process. Even if the server is running as user nobody it should certainly have the ability to terminate its children with a kill, of course I haven't tried it, but it stands to reason. If that approach does what you desire I would give it a shot. I feel silly for not pointing that out sooner.
--
http://www.nule.org
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Kill Processes on Pre-Forking Servers
by jlongino (Parson) on Oct 24, 2001 at 01:16 UTC |