A debian user reported that process spawned by genmon plugin were zombified because it doesn't wait for termination. Attached patch seems to fix the problem (but may have side effects too).
Created attachment 1532 wait for child termination
I don't want to change this behaviour because the change can cause the hung of the plugin, which is (for me) worse.
(In reply to comment #2) > I don't want to change this behaviour because the change can cause the hung of > the plugin, which is (for me) worse. Well, maybe there's another solution? Because letting zombies everywhere isn't really great either.
I know it's not a acceptable answer I made. But I think it's the script responsability to finish cleanly (manage timeout or things like that). It's surely possible to do better in the plugin, but I don't want to add too much complexity to the code. If somebody has an idea or a patch, he's welcomed ;)
(In reply to comment #4) > It's surely possible to do better in the plugin, but I don't want to add too > much complexity to the code. > > If somebody has an idea or a patch, he's welcomed ;) I don't know how xfrun handles this, but maybe there are good ideas to pick there?
A start point can be revision 26432 (see bug #2983)
The plugin hangs with patch 1532 because genmon_Spawn() is waiting for I/O when there will be none. With the patch, strace shows that genmon calls waitpid() and then hangs at poll(). Here's how to confirm. Configure a genmon command script to call /bin/true on click and set the period to one second. (Attachment follows.) $ ps -e | fgrep genmon 26211 ? 00:00:00 xfce4-genmon-pl $ strace -p 26211 -f 2>x.log x.log has these lines: ... [pid 26360] execve("/bin/true", ["/bin/true"], [/* 40 vars */]) = 0 ... [pid 26360] exit_group(0) = ? Process 26360 detached --- SIGCHLD (Child exited) @ 0 (0) --- waitpid(26360, NULL, 0) = 26360 poll( <unfinished ...> Process 26211 detached
Created attachment 1590 shell script to invoke /bin/true on clicking the genmon icon
The ability to click on a genmon icon to launch a program is already implemented with the Xfce launcher plugin. That plugin detaches the launched program (parent process of launched program has process id 1) and thereby avoids waiting or hanging. The genmon plugin is reimplementing the launcher functionality. Skimming the Xfce panel code, I see that it uses a variety of GLib functions, including g_spawn_sync() and g_spawn_async(). These functions are documented here: http://library.gnome.org/devel/glib/2.16/glib-Spawning-Processes.html
Created attachment 1592 patch to call xfce_exec() instead of genmon_SpawnCmd() With this patch there are no zombies and the child process does not hang the plugin. libxfcegui4 has a variety of functions for execing processes. See libxfcegui4/xfce-exec.h
Created attachment 1593 shell script to invoke sleep as a plugin command to test patch Use this plugin to simulate a non-exiting process. It simply invokes "sleep 3600" as the click command. The sleep processes should all have a parent process id of 1. ps -ef | fgrep sleep
Created attachment 1594 patch to call xfce_exec() instead of genmon_SpawnCmd(); with error handling This adds error handling if the command cannot be found. The error handling is adapted from: xfce4-panel-4.4.2/plugins/launcher/launcher.c
Do you consider the patch ready for production? I'm about to upload a fixed version to Debian.
Created attachment 1595 shell script to test patch by invoking various commands # Test cases for the Xfce genmon plugin's command launcher. # Configure the genmon plugin to invoke this shell script once per second. # Uncomment one of the "<click>" commands # while the plugin is running to test a particular case. # Each test case can be selected while the plugin is running, # because the plugin reinvokes the command each second.
(In reply to comment #13) > Do you consider the patch ready for production? I'm about to upload a fixed > version to Debian. > Yes, it is working with the test cases I have attached. 1. Commands are correctly invoked. 2. No zombies. 3. No hangs. 4. Error reporting when the command cannot be found.
Applied. Thanks