diff --git a/code/services-core/executor-service/src/main/java/nu/marginalia/actor/task/ActorProcessWatcher.java b/code/services-core/executor-service/src/main/java/nu/marginalia/actor/task/ActorProcessWatcher.java index 8f0445bd..4bae8674 100644 --- a/code/services-core/executor-service/src/main/java/nu/marginalia/actor/task/ActorProcessWatcher.java +++ b/code/services-core/executor-service/src/main/java/nu/marginalia/actor/task/ActorProcessWatcher.java @@ -73,6 +73,16 @@ public class ActorProcessWatcher { // Maybe the process died, wait a moment for it to restart if (!waitForProcess(processId, TimeUnit.SECONDS, 30)) { + + // Check if the process has already responded, but we missed it + // This infrequently happens if we get unlucky with the timing of the process terminating + // and the polling thread... + + var maybeResponse = outbox.pollResponse(msgId); + if (maybeResponse.isPresent()) { + return maybeResponse.get(); + } + throw new ActorControlFlowException("Process " + processId + " died and did not re-launch"); } }