Commit 6e41d892 authored by Leigh Stoller's avatar Leigh Stoller

If slice is locked when trying to terminate, say it is locked instead of

obscure "internal error".
parent 19df778a
......@@ -1350,6 +1350,13 @@ sub DoTerminate()
$slice->TakeLock();
}
elsif ($slice->Lock()) {
sleep(1);
if ($instance->canceled()) {
print "Instance is already marked as canceled\n";
exit(0);
}
#
# A special case is if the slice is provisioning. This means the
# user is giving up on it, and we want to tell the aggregate to
......@@ -1357,13 +1364,16 @@ sub DoTerminate()
# to be able to deal with that.
#
if ($instance->status() ne "provisioned") {
fatal("Slice is busy, cannot lock it");
}
if (!$instance->canceled()) {
print "Marking instance canceled\n";
$instance->MarkCanceled();
$errmsg = "Experiment is busy and not provisioned. This is unusual.";
if (defined($webtask)) {
$webtask->output($errmsg);
$webtask->Exited(GENIRESPONSE_BUSY);
}
print STDERR "$errmsg\n";
exit(GENIRESPONSE_BUSY);
}
sleep(1);
print "Marking instance canceled\n";
$instance->MarkCanceled();
# We have an obvious race here since we do not have the lock.
exit(0);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment