(actor) Try to rare data race where a finished job is considered dead.

This commit is contained in:
Viktor Lofgren 2024-01-22 21:22:38 +01:00
parent 562012fb22
commit dd26819d66

View file

@ -73,6 +73,16 @@ public class ActorProcessWatcher {
// Maybe the process died, wait a moment for it to restart // Maybe the process died, wait a moment for it to restart
if (!waitForProcess(processId, TimeUnit.SECONDS, 30)) { 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"); throw new ActorControlFlowException("Process " + processId + " died and did not re-launch");
} }
} }