diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2015-03-04T14·08+0100 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2015-03-04T14·13+0100 |
commit | 75ede65e3d2527cd9087c5a6970c4c5e6e26a0a8 (patch) | |
tree | ddd45eb92eb753e09f52b43be0cee74702041b73 /src/libstore/build.cc | |
parent | c2699be93b2bc7e5d9b9f7e1a671006cbd05cb0b (diff) |
Don't use vfork() before clone()
I'm seeing hangs in Glibc's setxid_mark_thread() again. This is probably because the use of an intermediate process to make clone() safe from a multi-threaded program (see 524f89f1399724e596f61faba2c6861b1bb7b9c5) is defeated by the use of vfork(), since the intermediate process will have a copy of Glibc's threading data structures due to the vfork(). So use a regular fork() again.
Diffstat (limited to 'src/libstore/build.cc')
-rw-r--r-- | src/libstore/build.cc | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/libstore/build.cc b/src/libstore/build.cc index 506eb633aae8..d0299914813c 100644 --- a/src/libstore/build.cc +++ b/src/libstore/build.cc @@ -1992,6 +1992,8 @@ void DerivationGoal::startBuilder() CLONE_PARENT to ensure that the real builder is parented to us. */ + ProcessOptions options; + options.allowVfork = false; Pid helper = startProcess([&]() { char stack[32 * 1024]; int flags = CLONE_NEWPID | CLONE_NEWNS | CLONE_NEWIPC | CLONE_NEWUTS | CLONE_PARENT | SIGCHLD; @@ -2004,7 +2006,7 @@ void DerivationGoal::startBuilder() if (child == -1) throw SysError("cloning builder process"); writeFull(builderOut.writeSide, int2String(child) + "\n"); _exit(0); - }); + }, options); if (helper.wait(true) != 0) throw Error("unable to start build process"); pid_t tmp; |