forked from akkadotnet/akka.net
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reproduced `IActorRef` leak inside the `EventStream`
- Loading branch information
1 parent
7123d0f
commit e805350
Showing
3 changed files
with
82 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// //----------------------------------------------------------------------- | ||
// // <copyright file="Bugfix5717Specs.cs" company="Akka.NET Project"> | ||
// // Copyright (C) 2009-2022 Lightbend Inc. <http://www.lightbend.com> | ||
// // Copyright (C) 2013-2022 .NET Foundation <https://github.com/akkadotnet/akka.net> | ||
// // </copyright> | ||
// //----------------------------------------------------------------------- | ||
|
||
using Akka.TestKit; | ||
using Xunit; | ||
|
||
namespace Akka.Tests.Event | ||
{ | ||
public class Bugfix5717Specs : AkkaSpec | ||
{ | ||
/// <summary> | ||
/// Reproduction for https://github.com/akkadotnet/akka.net/issues/5717 | ||
/// </summary> | ||
[Fact] | ||
public void Should_unsubscribe_from_all_topics_on_Terminate() | ||
{ | ||
var es = Sys.EventStream; | ||
var tm1 = 1; | ||
var tm2 = "FOO"; | ||
var a1 = CreateTestProbe(); | ||
var a2 = CreateTestProbe(); | ||
|
||
es.Subscribe(a1.Ref, typeof(int)); | ||
es.Subscribe(a2.Ref, typeof(int)); | ||
es.Subscribe(a2.Ref, typeof(string)); | ||
es.Publish(tm1); | ||
es.Publish(tm2); | ||
a1.ExpectMsg(tm1); | ||
a2.ExpectMsg(tm1); | ||
a2.ExpectMsg(tm2); | ||
|
||
// kill second test probe | ||
Watch(a2); | ||
Sys.Stop(a2); | ||
ExpectTerminated(a2); | ||
|
||
EventFilter.DeadLetter().Expect(0, () => | ||
{ | ||
es.Publish(tm1); | ||
es.Publish(tm2); | ||
a1.ExpectMsg(tm1); | ||
}); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters