November Happy Hour will be moved to Thursday December 5th.

Weird error suddenly appeared in iis-log poiting to duplicate scheduled job, and site didnt load

Vote:
 

Hi!

Today we suddenly got report from our users that our site wasnt reachable. In eventlog we found this error:

hit unexpected managed exception, exception code = '0xe0434352'. First 30KB characters of captured stdout and stderr logs:
warn: Microsoft.AspNetCore.DataProtection.Repositories.EphemeralXmlRepository[50]
      Using an in-memory repository. Keys will not be persisted to storage.
warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[59]
      Neither user profile nor HKLM registry available. Using an ephemeral key repository. Protected data will be unavailable when application exits.
warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35]
      No XML encryptor configured. Key {4a35e988-cb5f-42af-a9cd-454e0a950597} may be persisted to storage in unencrypted form.
warn: EPiServer.Data.DataInitialization[0]
      Database connection is configured to allow MultipleActiveResultSets. Consider disable MultipleActiveResultSets for better performance.
Unhandled exception. System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.AggregateException: One or more errors occurred. (Collection was modified; enumeration operation may not execute.)
 ---> System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
   at System.Collections.Generic.Dictionary`2.ValueCollection.Enumerator.MoveNext()
   at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
   at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
   at System.Linq.Lookup`2.Create(IEnumerable`1 source, Func`2 keySelector, IEqualityComparer`1 comparer)
   at System.Linq.GroupedEnumerable`2.GetEnumerator()
   at System.Linq.Enumerable.TryGetFirst[TSource](IEnumerable`1 source, Func`2 predicate, Boolean& found)
   at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
   at EPiServer.Scheduler.Internal.DefaultScheduledJobScanner.DuplicateDetection(IEnumerable`1 scheduledJobTypes)
   at EPiServer.Scheduler.Internal.DefaultScheduledJobScanner.Scan()
   at EPiServer.Scheduler.Internal.SchedulerInitialization.<>c__DisplayClass4_0.<Initialize>b__0()
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.Tasks.Task.<>c.<.cctor>b__272_0(Object obj)
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)

We do have one scehduled job that we made ourselves but it has been working perfectly for months without any issues, and I didnt find any duplicate jobs in admin tools when looking att de view for scheduled jobs.

A simple restart of IIS resolved the issue for now. Any ideas what might have caused this? 

Using Episerver 12.9.2

thanks!

/Rickard

#301059
Edited, May 02, 2023 9:08
Vote:
 

It says jobs have same GUID. Well I am not sure how did you run into this one but worth checking the GUID matches with existing scheduled job.

private static void DuplicateDetection(IEnumerable<PlugInDescriptor> scheduledJobTypes)
    {
      IGrouping<Guid, <>f__AnonymousType10<string, ScheduledPlugInAttribute>> source = scheduledJobTypes.Select(t => new
      {
        FullName = t.TypeName + "," + t.AssemblyName,
        Attribute = t.GetAttribute<ScheduledPlugInAttribute>()
      }).Where(t => t.Attribute != null && t.Attribute.GetGUID().HasValue).GroupBy(t => t.Attribute.GetGUID().Value).FirstOrDefault<IGrouping<Guid, <>f__AnonymousType10<string, ScheduledPlugInAttribute>>>(g => g.Count() > 1);
      if (source != null)
        throw new SynchronizationException(string.Format("Multiple scheduled jobs uses the same GUID '{0}': {1}", (object) source.First().Attribute.GetGUID(), (object) string.Join(", ", source.Select(d => "'" + d.FullName + "'"))));
    }
#301511
May 11, 2023 8:13
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.