After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 319861 - Subprocesses Zombify on Exit
Subprocesses Zombify on Exit
Status: RESOLVED FIXED
Product: deskbar-applet
Classification: Deprecated
Component: general
Git master
Other Linux
: Normal normal
: ---
Assigned To: Deskbar Applet Maintainer(s)
Deskbar Applet Maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2005-10-26 14:23 UTC by Martin Grondin
Modified: 2005-10-30 17:59 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch to fix zombies (10.56 KB, patch)
2005-10-30 01:05 UTC, Martin Grondin
none Details | Review
Correct Patch (6.83 KB, patch)
2005-10-30 05:43 UTC, Martin Grondin
none Details | Review
This will work... reallyE (6.82 KB, patch)
2005-10-30 05:51 UTC, Martin Grondin
none Details | Review
New patch fixes google-live.py (7.44 KB, patch)
2005-10-30 14:34 UTC, Martin Grondin
none Details | Review
beagle-live.py now fixed also (8.11 KB, patch)
2005-10-30 17:13 UTC, Martin Grondin
none Details | Review
Fixed (8.32 KB, patch)
2005-10-30 17:32 UTC, Martin Grondin
none Details | Review

Description Martin Grondin 2005-10-26 14:23:44 UTC
1.) Enable "Desktop Programs" or "Command line programs"
2.) Enter in a command to be executed
3.) Exit out of program that was executed

The spawmed program becomes a zombie on the system. The processes don't quit
fully until deskbar-applet is exited.

This bug is caused by spawn* being used with P_NOWAIT and seems to be
unavoidable. I tried executing xterm in the python interpreter and noticed the
same thing happened. To cause the zombie process to exit I had to call waitpid
as "os.waitpid(pid, os.WNOHANG)". The process then exits fully and returns a
tuple with the pid and the exit status.

If I knew Python better I'd write the code but I'd hate to ruin such a good
project with bad code :p
Comment 1 Martin Grondin 2005-10-30 01:05:51 UTC
Created attachment 54066 [details] [review]
Patch to fix zombies

Here is the patch to fix zombie processes. Basically replaces spawn with
gobject.spawn_async. Processes no longer zombie on exit. only thing not changed
is beaglelive.py (I'm not sure what 'actions' is and I don't have beagle
running/installed.)

This is my first time ever submitting a patch... so I'm a bit nervous. Hope it
works.
Comment 2 Martin Grondin 2005-10-30 05:43:52 UTC
Created attachment 54071 [details] [review]
Correct Patch

Well. First time I made a big mistake. Fixed now. This is the correct patch :p
Good thing I caught that.
Comment 3 Martin Grondin 2005-10-30 05:51:54 UTC
Created attachment 54072 [details] [review]
This will work... reallyE

:(

An extra space on one line. I scowered it this time. How embarassing. Third
time is the charm, no?
Comment 4 Mikkel Kamstrup Erlandsen 2005-10-30 09:41:42 UTC
Well the patch seems to work for me atleast Martin :)

The only handlers left are the *-live ones right?
Comment 5 Martin Grondin 2005-10-30 14:34:04 UTC
Created attachment 54083 [details] [review]
New patch fixes google-live.py

Only thing left not fixed is beagle-live.py. Not sure how the plugin works
entirely.. but basically the first argument just needs to be a list of strings
(can't have a string and then a list in a list, for example).
Comment 6 Raphael Slinckx 2005-10-30 16:53:58 UTC
The beagle-live fix is the same, just use "args" as the list to spawn_async,
normally the program (named "action") is set in as the first element of the list.
Comment 7 Martin Grondin 2005-10-30 17:13:38 UTC
Created attachment 54091 [details] [review]
beagle-live.py now fixed also

Thanks. Here is the full patch for all the os.spawn*

Zombies eradicated just in time for Halloween.
Comment 8 Martin Grondin 2005-10-30 17:32:18 UTC
Created attachment 54093 [details] [review]
Fixed

Didn't need to append action to the args, it was done already. Also forgot to
import gobject. I tested this out again and it works fine. As you can tell I'm
very new to the patching thing.
Comment 9 Raphael Slinckx 2005-10-30 17:59:57 UTC
In CVS, thanks for the first patch , and welcome on board :)