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 579776 - Close file descriptors on re-exec
Close file descriptors on re-exec
Status: RESOLVED FIXED
Product: gnome-shell
Classification: Core
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
Depends on:
Blocks:
 
 
Reported: 2009-04-21 21:25 UTC by Owen Taylor
Modified: 2009-04-23 18:11 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Close file descriptors on re-exec (4.01 KB, patch)
2009-04-21 21:25 UTC, Owen Taylor
reviewed Details | Review

Description Owen Taylor 2009-04-21 21:25:54 UTC
Use code copied from GLib to close all file descriptors before we reexec ourselves
on the restart Alt-F2 command. This fixes serious memory leaks when we have mapped
graphics buffers.
Comment 1 Owen Taylor 2009-04-21 21:25:58 UTC
Created attachment 133073 [details] [review]
Close file descriptors on re-exec
Comment 2 Dan Winship 2009-04-21 21:44:45 UTC
i confirm that you have successfully copied and pasted! :)

as discussed on irc, i feel like it would be better to NOT copy and paste this, but we can revisit that later. (when we get to the point where gnome-shell is actually being started by gnome-session, we can just do the exit-and-let-gnome-session-restart-you trick)
Comment 3 Colin Walters 2009-04-22 13:54:02 UTC
Looks fine for now though (though I would add a space before parens in the call).

Comment 4 Owen Taylor 2009-04-23 17:44:45 UTC
Committed as is (adding the space.) The approach of g_spawn() then quit the parent is probably better, but not enough better in my estimation to redo the patch.

There might also be a little more potential for races with the spawn-and-quit approach. (Though there is a potential for races in the exec approach as well... the X server won't necessarily have seen the X fd closed before the child tries to claim the window manager selection.)
Comment 5 Dan Winship 2009-04-23 18:11:16 UTC
(In reply to comment #4)
> (Though there is a potential for races in the exec approach as
> well... the X server won't necessarily have seen the X fd closed before the
> child tries to claim the window manager selection.)

If that turns out to be a problem, we can just always pass --replace when re-exec'ing.