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 495589 - gspawn.c failing to set FD_CLOEXEC
gspawn.c failing to set FD_CLOEXEC
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: general
2.14.x
Other Mac OS
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
: 501518 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2007-11-10 13:32 UTC by Tommi Komulainen
Modified: 2008-01-06 23:16 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Fall back to sysconf when rlim_max == RLIM_INFINITY to avoid integer overflow (407 bytes, patch)
2007-11-10 13:34 UTC, Tommi Komulainen
none Details | Review

Description Tommi Komulainen 2007-11-10 13:32:39 UTC
On OSX (Tiger) gspawn.c is failing to close file descriptors under some circumstances, causing for example giggle hang indefinitely. (But it doesn't hang if you run it in gdb.)

The cause seems to be in fdwalk(); getrlimit is returning rlim_max == RLIM_INFINITY (63 low bits set) which assigned to gint breaks the for loop. When that happens the value from sysconf should be used instead, at least it works for me.
Comment 1 Tommi Komulainen 2007-11-10 13:34:20 UTC
Created attachment 98866 [details] [review]
Fall back to sysconf when rlim_max == RLIM_INFINITY to avoid integer overflow
Comment 2 Richard Hult 2007-12-03 22:10:13 UTC
I debugged this last week and came to the same conclusion. The patch looks ok to me, except that maybe there can be more open fds than what sysconf says? I don't know why they differ, maybe sysconf is the soft limit (rlimit has a soft and hard one...)? Anyway, falling back to sysconf is what I did too and it fixed my problem as well.
Comment 3 Richard Hult 2007-12-03 22:17:07 UTC
Btw, interesting that you see that on tiger, it always worked for me on tiger and started failing on leopard...
Comment 4 Richard Hult 2007-12-05 09:00:38 UTC
*** Bug 501518 has been marked as a duplicate of this bug. ***
Comment 5 John Swensen 2007-12-05 21:23:15 UTC
Is there a reason why this hasn't been applied to the trunk?  Are there worries that there is a greater underlying problem and that this simple patch doesn't solve them?
Comment 6 Yevgen Muntyan 2007-12-07 17:20:18 UTC
I have a problem with spawning processes on mac too (application is frozen until the child process has died), and the patch does fix it for me. Tiger 10.4.9.
Comment 7 Richard Hult 2007-12-10 18:54:11 UTC
This also affects gtester from working.
Comment 8 Matthias Clasen 2008-01-06 23:16:14 UTC
2008-01-06  Matthias Clasen  <mclasen@redhat.com>

        * glib/gspawn.c (fdwalk): Don't set open_max to
        RLIM_INFINITY.  (#495589, Tommi Komulainen)