about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--third_party/nix/src/libstore/build.cc9
1 files changed, 4 insertions, 5 deletions
diff --git a/third_party/nix/src/libstore/build.cc b/third_party/nix/src/libstore/build.cc
index 502281d0051c..a009651c9d96 100644
--- a/third_party/nix/src/libstore/build.cc
+++ b/third_party/nix/src/libstore/build.cc
@@ -4241,14 +4241,13 @@ void SubstitutionGoal::handleEOF(int fd) {
 
 //////////////////////////////////////////////////////////////////////
 
-static bool working = false;
+ABSL_CONST_INIT static thread_local bool working = false;
 
 Worker::Worker(LocalStore& store, std::ostream& log_sink)
     : log_sink_(log_sink), store(store) {
-  /* Debugging: prevent recursive workers. */
-  if (working) {
-    abort();
-  }
+  // Debugging: prevent recursive workers.
+  // TODO(grfn): Do we need this?
+  CHECK(!working) << "Worker initialized during execution of a worker";
   working = true;
   nrLocalBuilds = 0;
   lastWokenUp = steady_time_point::min();