Gentoo Archives: gentoo-portage-dev

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

Replies