summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2013-07-18 12:52:16 +0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2013-07-18 12:52:29 +0200
commita4921b8ceb5bde3fbd1ae25ea4b367199796eded (patch)
treea8dae58d3640478ca2bed87ed79d61c3711fdeb4
parent16591eb3cccf86da8cd3f20c56e2dd847576ff5e (diff)
downloadguix-a4921b8ceb5bde3fbd1ae25ea4b367199796eded.tar.gz
Revert "build-remote.pl: Enforce timeouts locally"
This reverts commit 69b8f9980f39c14a59365a188b300a34d625a2cd.

The timeout should be enforced remotely.  Otherwise, if the garbage
collector is running either locally or remotely, if will block the
build or closure copying for some time.  If the garbage collector
takes too long, the build may time out, which is not what we want.
Also, on heavily loaded systems, copying large paths to and from the
remote machine can take a long time, also potentially resulting in a
timeout.
-rwxr-xr-xscripts/build-remote.pl.in5
-rw-r--r--src/libstore/build.cc4
2 files changed, 6 insertions, 3 deletions
diff --git a/scripts/build-remote.pl.in b/scripts/build-remote.pl.in
index 413d0402bf..a4eee75d1b 100755
--- a/scripts/build-remote.pl.in
+++ b/scripts/build-remote.pl.in
@@ -46,7 +46,7 @@ sub all { $_ || return 0 for @_; 1 }
 # Initialisation.
 my $loadIncreased = 0;
 
-my ($localSystem, $printBuildTrace) = @ARGV;
+my ($localSystem, $maxSilentTime, $printBuildTrace, $buildTimeout) = @ARGV;
 
 my $currentLoad = $ENV{"NIX_CURRENT_LOAD"};
 my $conf = $ENV{"NIX_REMOTE_SYSTEMS"};
@@ -261,7 +261,8 @@ close UPLOADLOCK;
 
 # Perform the build.
 my $buildFlags =
-    " --fallback --add-root $rootsDir/\$PPID.out --quiet"
+    "--max-silent-time $maxSilentTime --option build-timeout $buildTimeout"
+    . " --fallback --add-root $rootsDir/\$PPID.out --quiet"
     . " --option build-keep-log false";
 
 # We let the remote side kill its process group when the connection is
diff --git a/src/libstore/build.cc b/src/libstore/build.cc
index 30fbfb8a3a..1ca99dcc5c 100644
--- a/src/libstore/build.cc
+++ b/src/libstore/build.cc
@@ -695,7 +695,9 @@ HookInstance::HookInstance()
                 throw SysError("dupping builder's stdout/stderr");
 
             execl(buildHook.c_str(), buildHook.c_str(), settings.thisSystem.c_str(),
+                (format("%1%") % settings.maxSilentTime).str().c_str(),
                 (format("%1%") % settings.printBuildTrace).str().c_str(),
+                (format("%1%") % settings.buildTimeout).str().c_str(),
                 NULL);
 
             throw SysError(format("executing `%1%'") % buildHook);
@@ -1679,7 +1681,7 @@ HookReply DerivationGoal::tryBuildHook()
     set<int> fds;
     fds.insert(hook->fromHook.readSide);
     fds.insert(hook->builderOut.readSide);
-    worker.childStarted(shared_from_this(), hook->pid, fds, false, true);
+    worker.childStarted(shared_from_this(), hook->pid, fds, false, false);
 
     if (settings.printBuildTrace)
         printMsg(lvlError, format("@ build-started %1% - %2% %3%")