These are chat archives for akkadotnet/akka.net

11th
Jan 2019
Bartosz Sypytkowski
@Horusiath
Jan 11 06:54
@AndreSteenbergen since you don't have split brain (maybe auto-down too), then it may be that the node that is disconnecting, is never marked as downed and cannot rejoin the cluster because of that.

anyone know how to create a custom mqtt stream for akka net?

@anton55_gitlab AFAIK there's no connector build in out-of-the-box right now.

There's a project called Alpakka where we're building connectors from akka.streams to other systems. Many things there are ported from original Alpakka project (see: https://github.com/akka/Alpakka). I can see that, there are several projects related to MQTT there, that could be ported as a contribution.

Ebere Abanonu
@eaba
Jan 11 14:41
guys @Horusiath @Aaronontheweb I need to put an end to this beast:
2019-01-11 15:35:18.9413|DEBUG|product.Admin.Distributor.Actor.AdminDistributor|received handled message LoadSnapshotResult<toSeqNr: 9223372036854775807, snapshot: SelectedSnapshot<meta: SnapshotMetadata<pid: AdminDistributor, seqNr: 267, timestamp: 2018/12/31>, snapshot: AtLeastOnceDeliverySnapshot<currentDeliveryId: 267, unconfirmedDeliveries: 0>>> from akka://productAdmin/deadLetters
2019-01-11 15:35:19.0129|DEBUG|Akka.Persistence.Journal.ReplayFilter|Started (Akka.Persistence.Journal.ReplayFilter)
2019-01-11 15:35:19.0531|DEBUG|Akka.Persistence.SqlServer.Journal.BatchingSqlServerJournal|now supervising akka://productAdmin/system/akka.persistence.journal.sql-server/$a
2019-01-11 15:35:21.3838|DEBUG|Akka.Persistence.SqlServer.Journal.BatchingSqlServerJournal|Completed batch (chunkId: 63) of 1 operations in 2404.88 milliseconds
2019-01-11 15:35:21.4161|ERROR|product.Admin.Distributor.Actor.AdminDistributor|Persistence failure when replaying events for persistenceId [AdminDistributor]. Last known sequence number [267]
2019-01-11 15:35:21.4518|DEBUG|Akka.Persistence.Journal.ReplayFilter|Stopped
2019-01-11 15:35:21.4976|DEBUG|product.Admin.Distributor.Actor.AdminDistributor|received handled message ReplayMessagesFailure<cause: Newtonsoft.Json.JsonSerializationException: Cannot preserve reference to readonly dictionary, or dictionary created from a non-default constructor: System.Collections.Immutable.ImmutableDictionary`2[System.String,System.String]. Path 'Payload.Client', line 1, position 262.
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.ResolvePropertyAndCreatorValues(JsonObjectContract contract, JsonProperty containerProperty, JsonReader reader, Type objectType)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObjectUsingCreatorWithParameters(JsonReader reader, JsonObjectContract contract, JsonProperty containerProperty, ObjectConstructor`1 creator, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
   at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
   at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
   at Akka.Serialization.NewtonSoftJsonSerializer.FromBinary(Byte[] bytes, Type type)
   at Akka.Serialization.Serialization.Deserialize(Byte[] bytes, Int32 serializerId, String manifest)
   at Akka.Persistence.Sql.Common.Journal.BatchingSqlJournal`2.ReadEvent(DbDataReader reader)
   at Akka.Persistence.Sql.Common.Journal.BatchingSqlJournal`2.HandleReplayMessages(ReplayMessages req, TCommand command, IActorContext context)> from akka://productAdmin/deadLetters
The effect is this:
2019-01-11 15:35:21.5349|DEBUG|product.Admin.Distributor.Actor.AdminDistributor|Stopping
2019-01-11 15:35:21.5658|DEBUG|product.Admin.Distributor.Actor.AdminDistributor|no longer watched by [akka://productAdmin/system/recoveryPermitter#2029696666]
2019-01-11 15:35:21.5968|DEBUG|Akka.Routing.ResizablePoolActor|Stopping
2019-01-11 15:35:21.6263|DEBUG|Akka.Routing.ResizablePoolActor|Stopping
2019-01-11 15:35:21.6540|DEBUG|product.Database.Actor.AdminActor|no longer watched by [akka://productAdmin/user/AdminDistributor/Admin#20837550]
2019-01-11 15:35:21.6626|DEBUG|product.Admin.Response.Actor.AdninResponse|no longer watched by [akka://productAdmin/user/AdminDistributor/Responses#1386945307]
2019-01-11 15:35:21.6928|DEBUG|product.Admin.Response.Actor.AdninResponse|Stopped
2019-01-11 15:35:21.7219|DEBUG|product.Database.Actor.AdminActor|Stopped
2019-01-11 15:35:21.7438|DEBUG|Akka.Routing.ResizablePoolActor|Stopped
2019-01-11 15:35:21.7544|DEBUG|Akka.Routing.ResizablePoolActor|Stopped
2019-01-11 15:35:21.7783|DEBUG|product.Admin.Distributor.Actor.AdminDistributor|Stopped
I just need to understand whats happening.....I have always needed to press the red button which is deleting all tables to get it responding
Ebere Abanonu
@eaba
Jan 11 14:46
Some how this is critical issue for me......it cannot happen in production
Ismael Hamed
@ismaelhamed
Jan 11 15:18
@eaba does setting preserve-object-references = false for the serializer make any difference?
Ebere Abanonu
@eaba
Jan 11 15:44
How do I set that @ismaelhamed ?
Found it....I will give it a try
Ebere Abanonu
@eaba
Jan 11 15:55
@ismaelhamed
serialization-settings.json {
                        preserve-object-references = false
                        encode-type-names = false
                    }
that seems to be helping at the moment...I will see how far that takes me....thanks
I now see the deadletter messages being logged
Ebere Abanonu
@eaba
Jan 11 16:09
Does this apply to all serializer including messagepack?
Maciek Misztal
@mmisztal1980
Jan 11 16:17

hey all, one of my actors is triggering a top-level actor creation followed by forwarding the message cmd to it:

Akka.SearchController.References[name] = Context.System.ActorOf(Context.DI().Props<SearchController>(), name);
Akka.SearchController.References[name].Forward(cmd);
public static class Akka
    {
        public static ActorSystem System;
        public static class SearchController
        {
            public static IDictionary<string, IActorRef> References = new Dictionary<string, IActorRef>();
        }
    }

What I've noticed is that no messages seem to be reaching it and I'm not seeing any deadletters (WRN) logged either.
I've replaced my SearchController actor implementation with:

    public class SearchController : ReceiveActor
    {
        public const string ActorName = "search-controller";
        private readonly ILoggingAdapter log = Context.GetLogger();

        public SearchController()
        {
            Receive<object>(msg =>
            {
                log.Info("{Actor} received: {@Command}", Self.Path.Name, msg);
            });
        }
    }

and I don't seem to be receiving anything either...
I've verified that SearchController's c-tor is being called.

Does anyone have any hints to diagnose this?
At the moment, all actors are running on a single node.

Ebere Abanonu
@eaba
Jan 11 16:22
Maybe you should tweak Receive<object> a bit. Something more explicit
Also ensure you have the right reference to the actor
Maciek Misztal
@mmisztal1980
Jan 11 16:25
public class SearchController : UntypedActor
    {
        public const string ActorName = "search-controller";
        private readonly ILoggingAdapter log = Context.GetLogger();

        protected override void OnReceive(object message)
        {
            log.Info("{Actor} received: {@Command}", Self.Path.Name, message);
        }
    }

Changed to untyped ;) same effect...

If you look at the 1st code sample, the reference appears to be correct IMHO, although it was my 1st though too

Ebere Abanonu
@eaba
Jan 11 16:26
Enable full debugging
It is hard to tell
You might actually being telling the wrong actor
Maciek Misztal
@mmisztal1980
Jan 11 16:29

that was my 1st thought but :

Akka.SearchController.References[name] = Context.System.ActorOf(Context.DI().Props<SearchController>(), name);
Akka.SearchController.References[name].Forward(cmd);

seems to be right...

nothing with full debug logging :/
Ebere Abanonu
@eaba
Jan 11 16:31
And you are sure your log is properly setup?
Maciek Misztal
@mmisztal1980
Jan 11 16:42
akka : {
    stdout-loglevel : DEBUG
    loglevel : DEBUG
    log-config-on-start : on
    loggers : ["Akka.Logger.Serilog.SerilogLogger, Akka.Logger.Serilog"]
    actor : {
      debug : {
        receive : on
        autoreceive : on
        lifecycle : on
        event-stream : on
        unhandled : on
      }
    }
  }
I'm pretty sure it is
Ebere Abanonu
@eaba
Jan 11 16:45
Can you try out loggers = ["Akka.Logger.NLog.NLogLogger, Akka.Logger.NLog"]?
So that we can be on same page
Maciek Misztal
@mmisztal1980
Jan 11 16:46
that'd include rewriting most of my logging stack, as I'm heavy into structured logging so ... nope :)
Ebere Abanonu
@eaba
Jan 11 16:46
If you can, then create a file in your project named NLog.config
@ismaelhamed you wont rewrite anything
inside the config paste this:
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

  <targets>
    <target name="file" xsi:type="File" fileName="Debugs.log" />
  </targets>

  <rules>
    <logger name="*" minlevel="Debug" writeTo="file" />
  </rules>

</nlog>
Everything is auto
Maciek Misztal
@mmisztal1980
Jan 11 16:48
I'm sorry but rewriting my logging stack is not an option :)
Ebere Abanonu
@eaba
Jan 11 16:48
Okay
I never wrote any logging stack
At times you will need to hack to see inside
Maciek Misztal
@mmisztal1980
Jan 11 16:52
right now I'm trying to see if there are any unhandled exceptions flying under the hood, but nothing is happening in there - which would indicate that maybe the IActorRef is incorrect, but on the other hand the code doesn't indicate this :/
Ebere Abanonu
@eaba
Jan 11 16:53
@mmisztal1980 I get you perfectly
Like I said, though it might be painful, unplug your logging stack
What I have pasted above logs everything including exceptions
Maciek Misztal
@mmisztal1980
Jan 11 16:55
I have a similar setup right now :)
Maciek Misztal
@mmisztal1980
Jan 11 21:13
interestingly, if I send PoisonPill.Instance to the actor before doing the .Tell a deadletter message is logged :D