Gentoo Archives: gentoo-portage-dev

From: Brian Dolbec <dolsen@g.o>
To: gentoo-portage-dev@l.g.o
Subject: Re: [gentoo-portage-dev] Re: [PATCH] spawn: instantiate userpriv_groups before fork (bug 582098)
Date: Fri, 27 Jan 2017 00:41:39
Message-Id: 20170126164133.56fe9a1f.dolsen@gentoo.org
In Reply to: [gentoo-portage-dev] Re: [PATCH] spawn: instantiate userpriv_groups before fork (bug 582098) by Zac Medico
1 On Thu, 26 Jan 2017 16:05:47 -0800
2 Zac Medico <zmedico@g.o> wrote:
3
4 > On 01/25/2017 04:21 PM, Zac Medico wrote:
5 > > Make spawn force instantiation of portage.data.userpriv_groups in
6 > > the main process, in order to avoid redundant instantiation in child
7 > > processes. This mitigates the impact of "Bad file descriptor" errors
8 > > reported in bug 582098, by avoiding redundant instantiation of
9 > > userpriv_groups in child processes. It may even solve the problem
10 > > completely, if the "Bad file descriptor" errors are triggered by
11 > > interactions between garbage collection and the file descriptor
12 > > operations performed in the _exec function by the _setup_pipes call.
13 > >
14 > > X-Gentoo-Bug: 582098
15 > > X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=582098
16 > > ---
17 > > pym/portage/process.py | 4 ++++
18 > > 1 file changed, 4 insertions(+)
19 > >
20 > > diff --git a/pym/portage/process.py b/pym/portage/process.py
21 > > index ba41ea8..bc4efb5 100644
22 > > --- a/pym/portage/process.py
23 > > +++ b/pym/portage/process.py
24 > > @@ -305,6 +305,10 @@ def spawn(mycommand, env={}, opt_name=None,
25 > > fd_pipes=None, returnpid=False, if unshare_net or unshare_ipc:
26 > > find_library("c")
27 > >
28 > > + # Force instantiation of portage.data.userpriv_groups
29 > > before the
30 > > + # fork, so that the result is cached in the main process.
31 > > + bool(groups)
32 > > +
33 > > parent_pid = os.getpid()
34 > > pid = None
35 > > try:
36 > >
37 >
38 > Pushed:
39 >
40 > https://gitweb.gentoo.org/proj/portage.git/commit/?id=ccf975296daec92d376c4989e5ffb2a6cdbe8a2d
41
42 Sorry, it's been hard to keep up with email last few days, but yeah,
43 this is a trivial patch. I know it's been a bastard to track down the
44 source of the problem. Thanks
45
46 --
47 Brian Dolbec <dolsen>