Skip to content

Commit

Permalink
Fix JobDispatcher crash during force cancellation.
Browse files Browse the repository at this point in the history
  • Loading branch information
TingluoHuang committed Jan 30, 2024
1 parent b7ab810 commit 91ee4ed
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 91ee4ed

Please sign in to comment.