diff --git a/src/Proto.Actor/Context/ActorContext.cs b/src/Proto.Actor/Context/ActorContext.cs index 639326e7ba..762fbac021 100644 --- a/src/Proto.Actor/Context/ActorContext.cs +++ b/src/Proto.Actor/Context/ActorContext.cs @@ -670,6 +670,13 @@ private IActor IncarnateActor() private async ValueTask HandleRestartAsync() { + //restart invoked but system is stopping. stop the actor + if (System.Shutdown.IsCancellationRequested) + { + await HandleStopAsync(); + return; + } + _state = ContextState.Restarting; CancelReceiveTimeout(); await InvokeUserMessageAsync(Restarting.Instance).ConfigureAwait(false);