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 355499 - ensure_current_registry_forking() fails if zombie already killed by signal handler
ensure_current_registry_forking() fails if zombie already killed by signal h...
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
git master
Other Linux
: Normal normal
: 0.10.11
Assigned To: Jan Schmidt
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2006-09-11 21:41 UTC by Sean Egan
Modified: 2006-10-03 15:12 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
use pipes to read a result from the child (4.13 KB, patch)
2006-10-03 11:12 UTC, Jan Schmidt
none Details | Review
Don't leak fd in the parent (4.17 KB, patch)
2006-10-03 14:28 UTC, Jan Schmidt
none Details | Review

Description Sean Egan 2006-09-11 21:41:19 UTC
gst_init calls ensure_current_registry_forking() which forks. It then calls waitpid() on the child and fails initialization if waitpid() fails.

If an application has a handler for SIGCHLD to kill zombies, the signal handler and ensure_current_registry_forking are in a race to kill the zombie; if the app gets it first, initialization fails. This was the case in Gaim.  Our (hacky) workaround is to delay our waitpid() one second to allow gstreamer to kill it.

Gstreamer 0.10.10 allows you to programmatically turn off forking programtically, but it would be nice if the forking behavior were changed to avoid this entirely; it could take an application developer a long time debugging to realize the problem and turn off forking.

A suggestion would be to ignore the return value of waitpid and get back the status in a pipe.
Comment 1 Jan Schmidt 2006-10-03 11:12:29 UTC
Created attachment 73933 [details] [review]
use pipes to read a result from the child

This patch uses a pipe pair to receive a single byte result from the child indicating success or failure. It still does waitpid to ensure the child is reaped, but now ignores the result.
Comment 2 Jan Schmidt 2006-10-03 14:28:50 UTC
Created attachment 73950 [details] [review]
Don't leak fd in the parent

Updated patch that closes the read end of the pipe when done so the parent doesn't leak an fd.
Comment 3 Michael Smith 2006-10-03 14:31:16 UTC
I haven't tested this, but the updated version looks ok to me. Assuming it works,  go ahead. 
Comment 4 Jan Schmidt 2006-10-03 15:11:34 UTC
ta, committed:
        * gst/gst.c: (ensure_current_registry_forking):
        Use a pipe pair to receive status results from the forked child, and
        ignore the result from waitpid. Fixes #355499