Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Race condition between Logging and Remote when creating custom loggers #7304

Closed
Arkatufus opened this issue Jul 25, 2024 · 0 comments · Fixed by #7305
Closed

Race condition between Logging and Remote when creating custom loggers #7304

Arkatufus opened this issue Jul 25, 2024 · 0 comments · Fixed by #7305

Comments

@Arkatufus
Copy link
Contributor

Version Information

Version of Akka.NET? 1.5.27
Which Akka.NET Modules? Core

Describe the bug

Custom logger actor will have a severe NRE problem when they are run inside actor systems with remoting.

[ERROR][07/25/2024 21:38:52.569Z][Thread 0042][akka://Sys/system/custom-Logger] Error while creating actor instance of type Akka.Logger.Custom.CustomLogger with 0 args: ()
Cause: [akka://Sys/system/custom-Logger#848812227]: Akka.Actor.ActorInitializationException: Exception during creation ---> System.TypeLoadException: Error while creating actor instance of type Akka.Logger.Custom.CustomLogger with 0 args: () ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object.
   at Akka.Remote.RemoteActorRefProvider.get_DefaultAddress()
   at Akka.Event.LogSource.Create(Object o, ActorSystem system)
   at Akka.Event.Logging.GetLogger(IActorContext context, ILogMessageFormatter logMessageFormatter)
   at Akka.Logger.Custom.CustomLogger..ctor() in D:\Work\Projects\Akka.Logger.Custom\CustomLogger.cs:line 17
   --- End of inner exception stack trace ---
   at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
   at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
   at System.Activator.CreateInstance(Type type, Boolean nonPublic)
   at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark)
   at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
   at System.Activator.CreateInstance(Type type, Object[] args)
   at Akka.Actor.Props.ActivatorProducer.Produce()
   at Akka.Actor.Props.NewActor()
   --- End of inner exception stack trace ---
   at Akka.Actor.Props.NewActor()
   at Akka.Actor.ActorCell.CreateNewActorInstance()
   at Akka.Actor.ActorCell.<>c__DisplayClass116_0.<NewActor>b__0()
   at Akka.Actor.ActorCell.UseThreadContext(Action action)
   at Akka.Actor.ActorCell.NewActor()
   at Akka.Actor.ActorCell.Create(Exception failure)
   --- End of inner exception stack trace ---
   at Akka.Actor.ActorCell.Create(Exception failure)
   at Akka.Actor.ActorCell.SysMsgInvokeAll(EarliestFirstSystemMessageList messages, Int32 currentState)
Akka.Event.InitializeLogger
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants