@@ -869,6 +869,9 @@ class DerivationGoal : public Goal
869869
870870 std::unique_ptr<Activity> act;
871871
872+ /* Activity that denotes waiting for a lock. */
873+ std::unique_ptr<Activity> actLock;
874+
872875 std::map<ActivityId, Activity> builderActivities;
873876
874877 /* The remote machine on which we're building. */
@@ -1439,10 +1442,15 @@ void DerivationGoal::tryToBuild()
14391442 lockFiles.insert (worker.store .Store ::toRealPath (outPath));
14401443
14411444 if (!outputLocks.lockPaths (lockFiles, " " , false )) {
1445+ if (!actLock)
1446+ actLock = std::make_unique<Activity>(*logger, lvlWarn, actBuildWaiting,
1447+ fmt (" waiting for lock on %s" , yellowtxt (showPaths (lockFiles))));
14421448 worker.waitForAWhile (shared_from_this ());
14431449 return ;
14441450 }
14451451
1452+ actLock.reset ();
1453+
14461454 /* Now check again whether the outputs are valid. This is because
14471455 another process may have started building in parallel. After
14481456 it has finished and released the locks, we can (and should)
@@ -1481,13 +1489,17 @@ void DerivationGoal::tryToBuild()
14811489 case rpAccept:
14821490 /* Yes, it has started doing so. Wait until we get
14831491 EOF from the hook. */
1492+ actLock.reset ();
14841493 result.startTime = time (0 ); // inexact
14851494 state = &DerivationGoal::buildDone;
14861495 started ();
14871496 return ;
14881497 case rpPostpone:
14891498 /* Not now; wait until at least one child finishes or
14901499 the wake-up timeout expires. */
1500+ if (!actLock)
1501+ actLock = std::make_unique<Activity>(*logger, lvlWarn, actBuildWaiting,
1502+ fmt (" waiting for a machine to build '%s'" , yellowtxt (worker.store .printStorePath (drvPath))));
14911503 worker.waitForAWhile (shared_from_this ());
14921504 outputLocks.unlock ();
14931505 return ;
@@ -1497,6 +1509,8 @@ void DerivationGoal::tryToBuild()
14971509 }
14981510 }
14991511
1512+ actLock.reset ();
1513+
15001514 /* Make sure that we are allowed to start a build. If this
15011515 derivation prefers to be done locally, do it even if
15021516 maxBuildJobs is 0. */
@@ -1524,7 +1538,9 @@ void DerivationGoal::tryLocalBuild() {
15241538 uid. */
15251539 buildUser->kill ();
15261540 } else {
1527- debug (" waiting for build users" );
1541+ if (!actLock)
1542+ actLock = std::make_unique<Activity>(*logger, lvlWarn, actBuildWaiting,
1543+ fmt (" waiting for UID to build '%s'" , yellowtxt (worker.store .printStorePath (drvPath))));
15281544 worker.waitForAWhile (shared_from_this ());
15291545 return ;
15301546 }
@@ -1535,6 +1551,8 @@ void DerivationGoal::tryLocalBuild() {
15351551#endif
15361552 }
15371553
1554+ actLock.reset ();
1555+
15381556 try {
15391557
15401558 /* Okay, we have to build. */
@@ -4863,8 +4881,6 @@ void Worker::waitForInput()
48634881 up after a few seconds at most. */
48644882 if (!waitingForAWhile.empty ()) {
48654883 useTimeout = true ;
4866- if (lastWokenUp == steady_time_point::min ())
4867- printInfo (" waiting for locks, build slots or build users..." );
48684884 if (lastWokenUp == steady_time_point::min () || lastWokenUp > before) lastWokenUp = before;
48694885 timeout = std::max (1L ,
48704886 (long ) std::chrono::duration_cast<std::chrono::seconds>(
0 commit comments