You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@gump.apache.org by "Adam R. B. Jack" <aj...@trysybase.com> on 2004/03/29 00:33:45 UTC

Terminating a tree of processes...

I am quite disappointed by the fact that Gump cannot seem to terminate it's
child processes, and subsequent generations of processes. I can't seem to
find any portable solution, and even the per platform solutions contain race
conditions. Perhaps this is a limitation of the current state of Python, but
I hope it is that combined with lack of imagination/knowledge of this
developer, and as such help from this group can grant an acceptable
solution.

Take xdoclets, that is spawning, and re-spawning off into infinity. Any 'ps'
based approach to list/calculate a sub-tree of processes before killing them
individually allows a race condition, and such a case as xdoclets would fall
through that crack.

Still, the current approach only kills 'children' (the darn shell that runs
the command), so maybe this is better than nothing. I can try to find
something (make ps, if pgrep is less portable, since neither seem to do it
simply) to list all processes, plus parent process id, and hence determine
the genealogy.

I don't know what 'process group' gives me (on Unix, it isn't on M$) but is
there some way that a tree is a group? Can I find the group(s) for my
children and kill those groups without killing myself? Anybody know this?

Any other thoughts/approaches come to mind?

Thanks in advance.

regards

Adam
--
Experience the Unwired Enterprise:
http://www.sybase.com/unwiredenterprise
Try Sybase: http://www.try.sybase.com


---------------------------------------------------------------------
To unsubscribe, e-mail: general-unsubscribe@gump.apache.org
For additional commands, e-mail: general-help@gump.apache.org


Re: Terminating a tree of processes...

Posted by Leo Simons <ls...@jicarilla.org>.
Adam R. B. Jack wrote:
> I don't know what 'process group' gives me (on Unix, it isn't on M$) but is
> there some way that a tree is a group? Can I find the group(s) for my
> children and kill those groups without killing myself? Anybody know this?

I know I did this on linux once. But I forgot how. Will investigate...

> Any other thoughts/approaches come to mind?

everytime you spawn a child, record the id (a .pid file). Kill all the 
ids. I think most unix software records the ids. I have no idea how to 
do that top-of-head, but there's plenty of examples around the world, like

   /etc/rc.d/init.d/functions

-- 
cheers,

- Leo Simons

PS: Antoine says: I have seen that Adam has been successful in fixing 
the ant builds in gumpy. I do not have access to my Internet email now, 
but if I had I would sent him congrats. (via IM :-D)

-----------------------------------------------------------------------
Weblog              -- http://leosimons.com/
IoC Component Glue  -- http://jicarilla.org/
Articles & Opinions -- http://articles.leosimons.com/
-----------------------------------------------------------------------
"We started off trying to set up a small anarchist community, but
  people wouldn't obey the rules."
                                                         -- Alan Bennett


---------------------------------------------------------------------
To unsubscribe, e-mail: general-unsubscribe@gump.apache.org
For additional commands, e-mail: general-help@gump.apache.org


Re: Terminating a tree of processes...

Posted by Niclas Hedhman <ni...@hedhman.org>.
On Monday 29 March 2004 06:33, Adam R. B. Jack wrote:

> I don't know what 'process group' gives me (on Unix, it isn't on M$) but is
> there some way that a tree is a group? Can I find the group(s) for my
> children and kill those groups without killing myself? Anybody know this?

Not sure where you get "process group" from, but 'traditional' groups in 
processes on Linux is "user groups" of the user running the process.

AFAIK, Processes only have a single Parent, and I think your parsing the 
genealogy seems to be the only way (Don't know how that translates to M$ 
though).
Whether parsing "ps" output or reading the /proc/<pid>/status  file is 
better/faster/more portable, I wouldn't know, it just sounds easier to me.

-- 
+---------//-------------------+
|   http://www.bali.ac         |
|  http://niclas.hedhman.org   |
+------//----------------------+

---------------------------------------------------------------------
To unsubscribe, e-mail: general-unsubscribe@gump.apache.org
For additional commands, e-mail: general-help@gump.apache.org