简体   繁体   中英

Filtering out Orleans Reminder Grains at startup when they load into the memory from MySQL server

My application at the startup loads all of the reminder grains from the MySQL server but the server contains different type of reminder grains from different applications.

It means I got these kind of exceptions because in my application I do not implement these reminder grain types:

[2023-01-11 09:12:50,240] ERROR Silo caught an unobserved exception thrown from context [Response WorkItem Name=ResponseWorkItem:Id=47,Type=Rejection, Ctx=[LowPrioritySystemTarget: S127.0.0.1:33172:411120758*stg/Orleans.Runtime.ReminderService.LocalReminderService/00000000@S00000000]]: Grain: [LowPrioritySystemTarget: S127.0.0.1:33172:411120758*stg/Orleans.Runtime.ReminderService.LocalReminderService/00000000@S00000000] -> Unrecoverable Rejection (info:  Orleans.Runtime.OrleansException: Unexpected: Cannot find an implementation class for grain interface -1909932397
   at Orleans.Runtime.GrainTypeManager.GetTypeInfo(Int32 typeCode, String& grainClass, PlacementStrategy& placement, String genericArguments) in /_/src/Orleans.Runtime/GrainTypeManager/GrainTypeManager.cs:line 130
   at Orleans.Runtime.Dispatcher.AddressMessage(Message message) in /_/src/Orleans.Runtime/Core/Dispatcher.cs:line 756
   at Orleans.Runtime.Dispatcher.AsyncSendMessage(Message message, IGrainContext sendingActivation) in /_/src/Orleans.Runtime/Core/Dispatcher.cs:line 692) Response S127.0.0.1:33172:411120758*grn//a0b0f916-22e3-be2b-c259-5077bfeef17d->S127.0.0.1:33172:411120758*stg/Orleans.Runtime.ReminderService.LocalReminderService/00000000@S00000000 #47: Orleans.Runtime.OrleansException: Unexpected: Cannot find the directory for grain class -1909932397
   at Orleans.Runtime.GrainDirectory.GrainDirectoryResolver.GetGrainDirectoryPerType(Int32 grainType) in /_/src/Orleans.Runtime/GrainDirectory/GrainDirectoryResolver.cs:line 47
   at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
   at Orleans.Runtime.GrainDirectory.GrainDirectoryResolver.Resolve(GrainId grainId) in /_/src/Orleans.Runtime/GrainDirectory/GrainDirectoryResolver.cs:line 41
   at Orleans.Runtime.GrainDirectory.GrainLocatorSelector.GetGrainLocator(GrainId grainId) in /_/src/Orleans.Runtime/GrainDirectory/GrainLocatorSelector.cs:line 37
   at Orleans.Runtime.GrainDirectory.GrainLocatorSelector.InvalidateCache(ActivationAddress address) in /_/src/Orleans.Runtime/GrainDirectory/GrainLocatorSelector.cs:line 33
   at Orleans.Runtime.InsideRuntimeClient.ReceiveResponse(Message message) in /_/src/Orleans.Runtime/Core/InsideRuntimeClient.cs:line 610
   at Orleans.Runtime.Scheduler.ResponseWorkItem.Execute() in /_/src/Orleans.Runtime/Scheduler/ResponseWorkItem.cs:line 30
   at Orleans.Runtime.Scheduler.TaskSchedulerUtils.RunWorkItemTask(IWorkItem todo) in /_/src/Orleans.Runtime/Scheduler/TaskSchedulerUtils.cs:line 21
   at System.Threading.Tasks.Task.InnerInvoke()
   at System.Threading.Tasks.Task.<>c.<.cctor>b__272_0(Object obj)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread). eventHeuristicName=Runtime_Error_100104, Id_i=100104, IsOrleansLog_b=true Orleans.Runtime.OrleansException: Unexpected: Cannot find the directory for grain class -1909932397
   at Orleans.Runtime.GrainDirectory.GrainDirectoryResolver.GetGrainDirectoryPerType(Int32 grainType) in /_/src/Orleans.Runtime/GrainDirectory/GrainDirectoryResolver.cs:line 47
   at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
   at Orleans.Runtime.GrainDirectory.GrainDirectoryResolver.Resolve(GrainId grainId) in /_/src/Orleans.Runtime/GrainDirectory/GrainDirectoryResolver.cs:line 41
   at Orleans.Runtime.GrainDirectory.GrainLocatorSelector.GetGrainLocator(GrainId grainId) in /_/src/Orleans.Runtime/GrainDirectory/GrainLocatorSelector.cs:line 37
   at Orleans.Runtime.GrainDirectory.GrainLocatorSelector.InvalidateCache(ActivationAddress address) in /_/src/Orleans.Runtime/GrainDirectory/GrainLocatorSelector.cs:line 33
   at Orleans.Runtime.InsideRuntimeClient.ReceiveResponse(Message message) in /_/src/Orleans.Runtime/Core/InsideRuntimeClient.cs:line 610
   at Orleans.Runtime.Scheduler.ResponseWorkItem.Execute() in /_/src/Orleans.Runtime/Scheduler/ResponseWorkItem.cs:line 30
   at Orleans.Runtime.Scheduler.TaskSchedulerUtils.RunWorkItemTask(IWorkItem todo) in /_/src/Orleans.Runtime/Scheduler/TaskSchedulerUtils.cs:line 21
   at System.Threading.Tasks.Task.InnerInvoke()
   at System.Threading.Tasks.Task.<>c.<.cctor>b__272_0(Object obj)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)

Is there a possibility in the Orleans to somehow filter out these type of reminder grains which are not belonging to my application at Startup?

The problem was that in the OrleansReminderTable ServiceId was the same for my application and for others how put other type of reminders.

so I had to this:

 siloHostBuilder.GetBuilder()
            .Configure<ClusterOptions>(options =>
            {
                options.ClusterId = "cluster-dev";
                options.ServiceId = "dev-Ac";
            });

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM