-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* reproduced #5717 Reproduced `IActorRef` leak inside the `EventStream` * cleaned up the `EventBusUnsubscriber` * close #5719 - cleaned up `EventStream` subscription management * added API approval For `Obsolete` attribute. * need to capture more data on why failures happen * harden bugfix5717specs
- Loading branch information
1 parent
d055f46
commit b6214ef
Showing
4 changed files
with
158 additions
and
163 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
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,66 @@ | ||
// //----------------------------------------------------------------------- | ||
// // <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 System; | ||
using System.Threading.Tasks; | ||
using Akka.Configuration; | ||
using Akka.TestKit; | ||
using Xunit; | ||
using Xunit.Abstractions; | ||
|
||
namespace Akka.Tests.Event | ||
{ | ||
public class Bugfix5717Specs : AkkaSpec | ||
{ | ||
public Bugfix5717Specs(ITestOutputHelper output) : base(Config.Empty, output){} | ||
|
||
/// <summary> | ||
/// Reproduction for https://github.com/akkadotnet/akka.net/issues/5717 | ||
/// </summary> | ||
[Fact] | ||
public async Task 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); | ||
|
||
/* | ||
* It's possible that the `Terminate` message may not have been processed by the | ||
* Unsubscriber yet, so we want to try this operation more than once to see if it | ||
* eventually executes the unsubscribe on the EventStream. | ||
* | ||
* If it still fails after multiple attempts, the issue is that the unsub was never | ||
* executed in the first place. | ||
*/ | ||
await AwaitAssertAsync(async () => | ||
{ | ||
await EventFilter.DeadLetter().ExpectAsync(0, () => | ||
{ | ||
es.Publish(tm1); | ||
es.Publish(tm2); | ||
a1.ExpectMsg(tm1); | ||
}); | ||
}, interval:TimeSpan.FromSeconds(250)); | ||
} | ||
} | ||
} |
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
Oops, something went wrong.