From b542b73ced7a1ef6bc8f83e2918672068ccbc52c Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 10 Aug 2018 20:25:43 +0200 Subject: [PATCH] hydra-eval-jobs: Reinitialize Boehm GC in the child This is necessary to prevent hangs in the garbage collector. --- src/hydra-eval-jobs/hydra-eval-jobs.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/hydra-eval-jobs/hydra-eval-jobs.cc b/src/hydra-eval-jobs/hydra-eval-jobs.cc index d0ecfeba..2be3dd80 100644 --- a/src/hydra-eval-jobs/hydra-eval-jobs.cc +++ b/src/hydra-eval-jobs/hydra-eval-jobs.cc @@ -1,6 +1,7 @@ #include #include +#define GC_LINUX_THREADS 1 #include #include "shared.hh" @@ -265,9 +266,14 @@ int main(int argc, char * * argv) ProcessOptions options; options.allowVfork = false; + GC_atfork_prepare(); + auto pid = startProcess([&]() { pipe.readSide = -1; + GC_atfork_child(); + GC_start_mark_threads(); + if (lastAttrPath != "") debug("resuming from '%s'", lastAttrPath); /* FIXME: The build hook in conjunction with import-from-derivation is causing "unexpected EOF" during eval */ @@ -300,6 +306,8 @@ int main(int argc, char * * argv) exit(0); }, options); + GC_atfork_parent(); + pipe.writeSide = -1; int status;