Page 1 of 1

Running processes show <defunct> after closing launche

Posted: Sun Feb 12, 2006 8:52 pm
by Beach
I have an app that is calling other external apps with "RunProgram". When I close the external launched app, it still show up in the process list with a "<defunct>" beside it. I read that it has something to do with waiting for the parent app (that launched it) to shut it down.

Are there any problems associated with this? Just curious.

Posted: Sun Feb 12, 2006 10:59 pm
by freak
I remember having this same problem in the beginning with the IDE/debugger on linux.
I don't remember how i solved it though.

Basically it means that the child process did not terminate correctly and is
somehow messed up. By using either a wait function (like waitpid_()) or
terminating the parent it should go away. (My guess is that when you do
this, the system knows that the parent is no longer connected to the child
and does a proper cleanup of the process)

This does mean that something went wrong, and iirc, by changing the way i terminated
the child process i was able to fix it.

As far as wether this is a problem: Well, it creates dead processes that consume
system resources. Its not dangerous or anything, but its just not a good way to do it either.

How exactly do you terminate the child process? (with PB's End, with exit_(), wil a kill ?)
And what does the child do? (does it use gtk, does it use any sort of pipes?)

Maybe with some hints i can remember what my problem was exactly with this and tell you its solution ;)

Posted: Mon Feb 13, 2006 1:30 am
by Beach
freak wrote:I remember having this same problem in the beginning with the IDE/debugger on linux.
I don't remember how i solved it though.

Basically it means that the child process did not terminate correctly and is
somehow messed up. By using either a wait function (like waitpid_()) or
terminating the parent it should go away. (My guess is that when you do
this, the system knows that the parent is no longer connected to the child
and does a proper cleanup of the process)

This does mean that something went wrong, and iirc, by changing the way i terminated
the child process i was able to fix it.

As far as wether this is a problem: Well, it creates dead processes that consume
system resources. Its not dangerous or anything, but its just not a good way to do it either.

How exactly do you terminate the child process? (with PB's End, with exit_(), wil a kill ?)
And what does the child do? (does it use gtk, does it use any sort of pipes?)

Maybe with some hints i can remember what my problem was exactly with this and tell you its solution ;)
One of the external apps is "xterm". I use something like RunProgram("xterm","-e ping localhost") which will open a x terminal and executes the command "ping localhost". When you do a control-c in the terminal window, xterm will close automatically. Looks normal until you check the processes. No big deal, they all go away after my pb app closes.

Thanks for your reply.