1 |
Make spawn force instantiation of portage.data.userpriv_groups in the |
2 |
main process, in order to avoid redundant instantiation in child |
3 |
processes. This mitigates the impact of "Bad file descriptor" errors |
4 |
reported in bug 582098, by avoiding redundant instantiation of |
5 |
userpriv_groups in child processes. It may even solve the problem |
6 |
completely, if the "Bad file descriptor" errors are triggered by |
7 |
interactions between garbage collection and the file descriptor |
8 |
operations performed in the _exec function by the _setup_pipes call. |
9 |
|
10 |
X-Gentoo-Bug: 582098 |
11 |
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=582098 |
12 |
--- |
13 |
pym/portage/process.py | 4 ++++ |
14 |
1 file changed, 4 insertions(+) |
15 |
|
16 |
diff --git a/pym/portage/process.py b/pym/portage/process.py |
17 |
index ba41ea8..bc4efb5 100644 |
18 |
--- a/pym/portage/process.py |
19 |
+++ b/pym/portage/process.py |
20 |
@@ -305,6 +305,10 @@ def spawn(mycommand, env={}, opt_name=None, fd_pipes=None, returnpid=False, |
21 |
if unshare_net or unshare_ipc: |
22 |
find_library("c") |
23 |
|
24 |
+ # Force instantiation of portage.data.userpriv_groups before the |
25 |
+ # fork, so that the result is cached in the main process. |
26 |
+ bool(groups) |
27 |
+ |
28 |
parent_pid = os.getpid() |
29 |
pid = None |
30 |
try: |
31 |
-- |
32 |
2.10.2 |