0

This message is written to the console in the simplest of Akka.net sample applications.

[INFO][11/3/2015 7:21:06 PM][Thread 0008][akka://TestActorSystem/user] Message DeathWatchNotification from akka://TestActorSystem/user to akka://TestActorSystem/user was not delivered. 1 dead letters encountered.

This is the very simple code, where all you do is create an actor, but you NEVER send any messages.

using System;
using Akka.Actor;
namespace AkkaNetTest {
    class Program {
        static void Main(string[] args) {
            ActorSystem testActorSystem = ActorSystem.Create("TestActorSystem");
            Console.WriteLine("Actor system 'TestActorSystem' created");
            IActorRef testActor = testActorSystem.ActorOf<TestActor>("Test");
            Console.WriteLine("Press a key to shutdown the 'TestActorSystem' actor system");
            Console.ReadKey();
            Console.WriteLine("Attempting to shutdown the actor system");
            testActorSystem.Shutdown();
            Console.WriteLine("Waiting for the actor system to terminate.");
            testActorSystem.AwaitTermination();
            Console.WriteLine("Actor system shutdown, press any key to exit");
            Console.ReadKey(); 
        }
    }
    public class TestActor : ReceiveActor { }
}

The environment I am running in is:

  • Windows 10 RTM build 10240
  • Visual Studio 2013 Update 5
  • Akka.Net via NeGet 1.0.4.12
  • Target framework .NET 4.5
  • Install framework .NET 4.5.2
  • Console Application
  • Any CPU

When you run this simple application the above Akka.net output occurs as soon as the ActorSystem.AwaitTermination() call is made.

It occurs in all my Akka.net applications I try to create and I was able to get it to reproduce in this simple application. So if I send messages or I don't send them it always occurs. If you comment out the IActorRef line then you will not get the message since no actors where created.

This doesn't make any sense why this is happening. If any one can help with explaining why this happens and how to prevent it from happening even when there are no messages that were ever sent then I would appreciate it.

Rodney S. Foley
  • 10,190
  • 12
  • 48
  • 66
  • I don't see that in the console at all with more or less the same setup except on Server 2012 R2. Do you have additional logging configured? – Mike Zboray Nov 03 '15 at 20:09
  • Logging for what? The full code application is 20 lines of code including the 5 console outputs. With the defaults values for Akka.net when retrieved from NuGet. Akka.net apparently has its own logging which is what is providing the output. Server 20012 R2 is not a full repro of the environment, so this could be something with Windows 10, however this may be unrelated as someone else posted a similar questions but didn't state his environment however no solutiuon for him. http://stackoverflow.com/questions/32386573/why-do-i-get-a-deathwatchnotification-of-an-undelivered-message-on-shutdown – Rodney S. Foley Nov 04 '15 at 16:21
  • I tried running on a Windows 10 machine (compiled on the other machine I mentioned) and it does indeed print that message in that environment. Interesting. They have slightly different CLR versions, 4.0.30319.34209 on server 2012 R2 vs 4.0.30319.42000 on Windows 10. – Mike Zboray Nov 04 '15 at 16:44
  • From what I can tell the difference in versions there corresponds to .NET Framework 4.5.2 vs 4.6. – Mike Zboray Nov 04 '15 at 16:52
  • Yeah I target 4.5 but I have 4.5.2 installed, so is this a bug in Akka.net? – Rodney S. Foley Nov 04 '15 at 22:05
  • Filed a bug just in case: https://github.com/akkadotnet/akka.net/issues/1405 – Rodney S. Foley Nov 04 '15 at 22:34
  • Yea I was going to suggest that. I thought Windows 10 came with .NET 4.6 by default or is it possible to downgrade? – Mike Zboray Nov 04 '15 at 22:46

2 Answers2

1

you're calling testActorSystem.Shutdown(); - this shuts down the ActorSystem. This kills off all of the actors, including the built-in system ones - so DeathWatchNotifications are fired as part of the shutdown and cleanup process. In this case the message you're seeing the the /user guardian actor shutting itself down, which doesn't get delivered because it's shutting down.

Not a bug and nothing to be worried about, as explained by the docs: http://getakka.net/docs/concepts/message-delivery-reliability#dead-letters-which-are-usually-not-worrisome

Aaronontheweb
  • 8,224
  • 6
  • 32
  • 61
  • As I have stated in the bug I reported I still think this is a bug and that it is with your default logging level being INFO and not at least WARNING. What you provided is not a SOLUTION to the problem just an attempt to explain it away. – Rodney S. Foley Nov 05 '15 at 17:51
  • @RodneyFoley from the other perspective what you've provided isn't solution either ;) You want to change behavior of the whole framework - and what's more important potentially disturb reliability of systems using Akka.NET in production - with no justification except that, you're getting logs you didn't understand when application stops. – Bartosz Sypytkowski Nov 07 '15 at 08:11
  • @Horusiath Really? The solution I provided is the official solution aaronontheweb provided in my bug report on their GitHub. That is the OFFICIAL solution to this issue they claim is not a bug. To go in an change an enterprise framework from not being INFO logging but to WARNING or ERROR. The justification is in the official bug I filed, and there response is this is how the Java Akka did it so we did it too. Making this change should impact really no production environment according to aaronontheweb since everything he claims everyone changes this in production already. – Rodney S. Foley Nov 10 '15 at 01:00
-2

To prevent this error you have to do the following until they fix their default logging level to be WARNING where it should be.

Add the following to your app config and the INFO log message will go away. @Aaronontheweb has stated in the bug report states that this message is "nothing to be worried about".

<configuration>
  <configSections>
    <section name="akka"
             type="Akka.Configuration.Hocon.AkkaConfigurationSection, Akka" />
  </configSections>
  <akka>
    <hocon>
      <![CDATA[
          akka {
            loglevel = WARNING
          }
      ]]>
    </hocon>
  </akka>
</configuration>
Rodney S. Foley
  • 10,190
  • 12
  • 48
  • 66
  • For those down voting this answer you should know this is the official solution to this issue from @aaronontheweb via the bug I reported. They claim there is no bug and that you have to do the above solution to stop INFO messages from being the default logging level for their enterprise class actor framework. Feel free to read it here where I got the correct answer from the source: https://github.com/akkadotnet/akka.net/issues/1405#issuecomment-153926751 Also it is encouraged to comment why you down vote an answer. – Rodney S. Foley Nov 10 '15 at 01:02