akka.net
akka.net copied to clipboard
IO-TCP logs unnecessary error message on flow termination
Version Information Version of Akka.NET? 1.5.13 Which Akka.NET Modules? Akka and Akka.Streams
On net472 target TcpStreams extensions logs out unnecessary error message when attached TCP flow is terminated. The message is not produced when target runs net7.0.
[ERROR][09/27/2023 13:15:59.865Z][Thread 0035][akka://my-system/system/IO-TCP/$a] Monitored actor [[akka://my-system/user/$a/StreamSupervisor-1/$$a#549811830]] terminated
Cause: Akka.Actor.DeathPactException: Monitored actor [[akka://my-system/user/$a/StreamSupervisor-1/$$a#549811830]] terminated
at Akka.Actor.ActorBase.Unhandled (System.Object message) [0x00015] in <d180930ef5f34340b9af3303aa68102d>:0
at Akka.Actor.ActorBase.AroundReceive (Akka.Actor.Receive receive, System.Object message) [0x00096] in <d180930ef5f34340b9af3303aa68102d>:0
at Akka.Actor.ActorCell.ReceiveMessage (System.Object message) [0x00023] in <d180930ef5f34340b9af3303aa68102d>:0
at Akka.Actor.ActorCell.ReceivedTerminated (Akka.Actor.Terminated t) [0x00042] in <d180930ef5f34340b9af3303aa68102d>:0
at Akka.Actor.ActorCell.AutoReceiveMessage (Akka.Actor.Envelope envelope) [0x000af] in <d180930ef5f34340b9af3303aa68102d>:0
at Akka.Actor.ActorCell.Invoke (Akka.Actor.Envelope envelope) [0x0006d] in <d180930ef5f34340b9af3303aa68102d>:0
To Reproduce Steps to reproduce the behavior:
-
git clone https://github.com/anpin/akka-mergehub-and-socket-repro
-
cd akka-mergehub-and-socket-repro/ConsoleApp1
-
dotnet run --framework net472
- depending on the random condition inside the loop the server might terminate with exception, regardless of it press Ctrl-C to close the app and observe the above exception
- Run the same example with
dotnet run --framework net7.0
and see no error after Ctrl-C
Note: the exception inside the server code was planted to illustrate another error message logged when MergeHub source is failing
Expected behavior The Monitored actor terminated message is not emitted on both platforms
Actual behavior The Monitored actor terminated message is emitted on net472, but not on dotnet
Environment Both Linux and Windows
.NET SDK: Version: 7.0.400 Commit: 73bf45718d
This is definitely a long-standing bug with Akka.IO - we're using a very sloppy technique for ensuring the mutual destruction of actors inside of here, hence the useless spam in the error logs. We should handle this more appropriately so it doesn't cast off unnecessary exceptions.