From d9af753a7f5f6c7e52582b596b78c9b870572cb6 Mon Sep 17 00:00:00 2001 From: eldritch horrors Date: Thu, 25 Jul 2024 18:05:42 +0200 Subject: [PATCH] libstore: always wake up goals on EOF all goals do this. it makes no sense to not notify a goal of EOF conditions because this is the universal signal for "child done" Change-Id: Ic3980de312547e616739c57c6248a8e81308b5ee --- src/libstore/build/derivation-goal.cc | 1 - src/libstore/build/drv-output-substitution-goal.cc | 5 ----- src/libstore/build/drv-output-substitution-goal.hh | 1 - src/libstore/build/goal.hh | 1 - src/libstore/build/substitution-goal.cc | 6 ------ src/libstore/build/substitution-goal.hh | 1 - src/libstore/build/worker.cc | 1 + 7 files changed, 1 insertion(+), 15 deletions(-) diff --git a/src/libstore/build/derivation-goal.cc b/src/libstore/build/derivation-goal.cc index 8899cebfb..c0ca18310 100644 --- a/src/libstore/build/derivation-goal.cc +++ b/src/libstore/build/derivation-goal.cc @@ -1363,7 +1363,6 @@ void DerivationGoal::handleChildOutput(int fd, std::string_view data) void DerivationGoal::handleEOF(int fd) { if (!currentLogLine.empty()) flushLine(); - worker.wakeUp(shared_from_this()); } diff --git a/src/libstore/build/drv-output-substitution-goal.cc b/src/libstore/build/drv-output-substitution-goal.cc index 69598472c..5e83d769c 100644 --- a/src/libstore/build/drv-output-substitution-goal.cc +++ b/src/libstore/build/drv-output-substitution-goal.cc @@ -162,10 +162,5 @@ void DrvOutputSubstitutionGoal::work() (this->*state)(); } -void DrvOutputSubstitutionGoal::handleEOF(int fd) -{ - worker.wakeUp(shared_from_this()); -} - } diff --git a/src/libstore/build/drv-output-substitution-goal.hh b/src/libstore/build/drv-output-substitution-goal.hh index 47b9ecc49..598b119dc 100644 --- a/src/libstore/build/drv-output-substitution-goal.hh +++ b/src/libstore/build/drv-output-substitution-goal.hh @@ -72,7 +72,6 @@ public: std::string key() override; void work() override; - void handleEOF(int fd) override; JobCategory jobCategory() const override { return JobCategory::Substitution; diff --git a/src/libstore/build/goal.hh b/src/libstore/build/goal.hh index d105c53cd..94346531e 100644 --- a/src/libstore/build/goal.hh +++ b/src/libstore/build/goal.hh @@ -145,7 +145,6 @@ public: virtual void handleEOF(int fd) { - abort(); } void trace(std::string_view s); diff --git a/src/libstore/build/substitution-goal.cc b/src/libstore/build/substitution-goal.cc index df88a5629..027a7e161 100644 --- a/src/libstore/build/substitution-goal.cc +++ b/src/libstore/build/substitution-goal.cc @@ -294,12 +294,6 @@ void PathSubstitutionGoal::handleChildOutput(int fd, std::string_view data) } -void PathSubstitutionGoal::handleEOF(int fd) -{ - worker.wakeUp(shared_from_this()); -} - - void PathSubstitutionGoal::cleanup() { try { diff --git a/src/libstore/build/substitution-goal.hh b/src/libstore/build/substitution-goal.hh index 52780a967..d85b3beb3 100644 --- a/src/libstore/build/substitution-goal.hh +++ b/src/libstore/build/substitution-goal.hh @@ -110,7 +110,6 @@ public: * Callback used by the worker to write to the log. */ void handleChildOutput(int fd, std::string_view data) override; - void handleEOF(int fd) override; /* Called by destructor, can't be overridden */ void cleanup() override final; diff --git a/src/libstore/build/worker.cc b/src/libstore/build/worker.cc index 25b20511b..5b2e36acb 100644 --- a/src/libstore/build/worker.cc +++ b/src/libstore/build/worker.cc @@ -459,6 +459,7 @@ void Worker::waitForInput() if (rd == 0 || (rd == -1 && errno == EIO)) { debug("%1%: got EOF", goal->getName()); goal->handleEOF(k); + wakeUp(goal); j->fds.erase(k); } else if (rd == -1) { if (errno != EINTR)