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

Non-documented breaking change of channel-executor configuration #5541

Closed
ok-ul-ch opened this issue Jan 26, 2022 · 6 comments · Fixed by #5568
Closed

Non-documented breaking change of channel-executor configuration #5541

ok-ul-ch opened this issue Jan 26, 2022 · 6 comments · Fixed by #5568

Comments

@ok-ul-ch
Copy link

Version Information
Version of Akka.NET? 1.4.32
Which Akka.NET Modules? Akka

Describe the bug
After update from 1.4.20 to 1.4.32 channel-executor configuration (see doc) is not valid anymore

To Reproduce
Steps to reproduce the behavior:

  1. Create a console app with Akka 1.4.29+
  2. Execute:
using Akka.Actor;

namespace ChannelExecutorIssue
{
    internal class Program
    {
        static void Main(string[] args)
        {
            // Following: https://getakka.net/articles/actors/dispatchers.html#channelexecutor
            var config = @"
                          akka.actor.default-dispatcher = { 
                                 executor = channel-executor
                          }";
            
            // Throws NRE in 1.4.29+
            var actorSystem = ActorSystem.Create("test", config);
        }
    }
}
  1. Observe

Expected behavior
ActorSystem created successfully

Actual behavior
NRE is thrown:

Unhandled exception. System.NullReferenceException: Object reference not set to an instance of an object.
   at Akka.Dispatch.ChannelExecutorConfigurator..ctor(Config config, IDispatcherPrerequisites prerequisites)
   at Akka.Dispatch.MessageDispatcherConfigurator.ConfigureExecutor()
   at Akka.Dispatch.DispatcherConfigurator..ctor(Config config, IDispatcherPrerequisites prerequisites)
   at Akka.Dispatch.Dispatchers.ConfiguratorFrom(Config cfg)
   at Akka.Dispatch.Dispatchers.LookupConfigurator(String id)
   at Akka.Dispatch.Dispatchers.Lookup(String dispatcherName)
   at Akka.Dispatch.Dispatchers..ctor(ActorSystem system, IDispatcherPrerequisites prerequisites, ILoggingAdapter logger)
   at Akka.Actor.Internal.ActorSystemImpl.ConfigureDispatchers()
   at Akka.Actor.Internal.ActorSystemImpl..ctor(String name, Config config, ActorSystemSetup setup, Nullable`1 guardianProps)
   at Akka.Actor.ActorSystem.CreateAndStartSystem(String name, Config withFallback, ActorSystemSetup setup)
   at Akka.Actor.ActorSystem.Create(String name, Config config)
   at ChannelExecutorIssue.Program.Main(String[] args)

The issue is in the default config for default-dispatcher that has no channel-executor.priority set. Introduced in #5403

Sidenote: default channel-scheduler configuration is expected to be at: akka.channel-scheduler

var config = system.Settings.Config.GetConfig("akka.channel-scheduler");

But it is actually located under akka.actor.channel-scheduler
Current workaround:

using Akka.Actor;

namespace ChannelExecutorIssue
{
    internal class Program
    {
        static void Main(string[] args)
        {
            //Copy akka.actor.channel-scheduler from Akka/Configuration/Pigeon.conf
            var config = @"
                          akka.channel-scheduler {
                              parallelism-min = 4    #same as for ForkJoinDispatcher
                              parallelism-factor = 1 #same as for ForkJoinDispatcher
                              parallelism-max = 64   #same as for ForkJoinDispatcher
                              work-max = 10          #max executed work items in sequence until priority loop
                              work-interval = 500    #time target of executed work items in ms
                              work-step = 2          #target work item count in interval / burst
                          }
                          akka.actor.default-dispatcher = { 
                              executor = channel-executor
                              channel-executor.priority = normal
                          }";
            
            var actorSystem = ActorSystem.Create("test", config);
        }
    }
}
@Aaronontheweb
Copy link
Member

@eaba can you take this one?

@Aaronontheweb
Copy link
Member

@mralexes thanks for reporting this - I totally missed that during the review.

@Aaronontheweb Aaronontheweb added this to the 1.4.33 milestone Jan 26, 2022
@ok-ul-ch
Copy link
Author

Might be related to #5498

@eaba
Copy link
Contributor

eaba commented Jan 27, 2022

@eaba can you take this one?

Ok @Aaronontheweb

@eaba
Copy link
Contributor

eaba commented Jan 27, 2022

The issue is in the default config for default-dispatcher that has no channel-executor.priority set

The default channel-executor.priority is normal if not set by the user:

Priority = (TaskSchedulerPriority)Enum.Parse(typeof(TaskSchedulerPriority), cfg.GetString("priority", "normal"), true);

@ok-ul-ch
Copy link
Author

@eaba yes, but only if cfg variable is not null, which is null in this case)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants