Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the CancellationTokenSource.Dispose() call inside of the ActorContextExtras.Dispose(). #1916 #1920

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/Proto.Actor/Context/ActorContextExtras.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
// <copyright file="ActorContextExtras.cs" company="Asynkron AB">
// Copyright (C) 2015-2022 Asynkron AB All rights reserved
// </copyright>
Expand Down Expand Up @@ -37,7 +37,14 @@ public ActorContextExtras(IContext context)
public void Dispose()
{
ReceiveTimeoutTimer?.Dispose();
CancellationTokenSource.Dispose();
ReceiveTimeoutTimer = null;

// NOTE: We don't dispose CancellationTokenSource here on purpose, doing so causes
// ActorSystem shutdown issues because of DefaultMailbox.PostSystemMessage doing
// a Cancel call on that CancellationTokenSource. This can occur in cases of stopping
// an actor twice. Given that we utilize this CancellationTokenSource only via the Cancel()
// call, doing a Dispose() call is not required. More info can be found here:
// https://github.com/asynkron/protoactor-dotnet/issues/1916
}

public void InitReceiveTimeoutTimer(Timer timer) => ReceiveTimeoutTimer = timer;
Expand Down