Compare commits

...

1 commit

Author SHA1 Message Date
raito 1f9d8dc0a6 hydra-queue-runner: do not assume reservation is available when build step throws unexpectedly
`reservation` might be null when an uncaught exception has been thrown.
We copy the data we need to report the error.

Signed-off-by: Raito Bezarius <raito@lix.systems>
2024-07-09 03:12:23 +02:00

View file

@ -28,6 +28,9 @@ void State::builder(MachineReservation::ptr reservation)
{
auto activeStep = std::make_shared<ActiveStep>();
auto machineSshName = reservation->machine->sshName;
auto drvPath = reservation->step->drvPath;
activeStep->step = reservation->step;
activeSteps_.lock()->insert(activeStep);
@ -39,9 +42,12 @@ void State::builder(MachineReservation::ptr reservation)
auto destStore = getDestStore();
res = doBuildStep(destStore, reservation, activeStep);
} catch (std::exception & e) {
if (!reservation) {
printMsg(lvlTalkative, "machine '%s' has been released earlier (e.g. at copying outputs phase)", machineSshName);
}
printMsg(lvlError, "uncaught exception building %s on %s: %s",
localStore->printStorePath(reservation->step->drvPath),
reservation->machine->sshName,
localStore->printStorePath(drvPath),
machineSshName,
e.what());
}
}