Skip to content

Commit

Permalink
Fix JobDispatcher crash during force cancellation. (#3118)
Browse files Browse the repository at this point in the history
  • Loading branch information
TingluoHuang authored Jan 30, 2024
1 parent 7414e08 commit 5268d74
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/Runner.Listener/JobDispatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,20 @@ await processChannel.SendAsync(
Trace.Info("worker process has been killed.");
}
}
catch (Exception ex)
{
// message send failed, this might indicate worker process is already exited or stuck.
Trace.Info($"Job cancel message sending for job {message.JobId} failed, kill running worker. {ex}");
workerProcessCancelTokenSource.Cancel();
try
{
await workerProcessTask;
}
catch (OperationCanceledException)
{
Trace.Info("worker process has been killed.");
}
}

// wait worker to exit
// if worker doesn't exit within timeout, then kill worker.
Expand Down

0 comments on commit 5268d74

Please sign in to comment.