Hi there, I am looking for some general advice, we have 2 web servers which frequently (once to twice a day) hit 100% CPU, using process explorer I can drill into the W3WP.exe and its associated threads to determine the cause, and it appears to be NHibernate when trying to either access or add to collections in the 'StatefulPersistenceContext' class. I have provided an example stack trace of the process which has been captured directly from the web server during high CPU, there are always 2-3 threads with the same stack trace:
mscorlib.dll!System.Collections.Generic.Dictionary`2.FindEntry+0x12c mscorlib.dll!System.Collections.Generic.Dictionary`2.TryGetValue+0x14 NHibernate.dll!NHibernate.Engine.StatefulPersistenceContext.AddCollection+0x170 NHibernate.dll!NHibernate.Engine.StatefulPersistenceContext.AddUninitializedCollection+0x9e NHibernate.dll!NHibernate.Type.CollectionType.GetCollection+0x344 NHibernate.dll!NHibernate.Type.CollectionType.ResolveKey+0x58 NHibernate.dll!NHibernate.Type.CollectionType.Assemble+0x12b NHibernate.dll!NHibernate.Type.TypeHelper.Assemble+0x2ab NHibernate.dll!NHibernate.Cache.Entry.CacheEntry.Assemble+0xae NHibernate.dll!NHibernate.Cache.Entry.CacheEntry.Assemble+0x12b NHibernate.dll!NHibernate.Event.Default.DefaultLoadEventListener.AssembleCacheEntry+0x601 NHibernate.dll!NHibernate.Event.Default.DefaultLoadEventListener.LoadFromSecondLevelCache+0xa30 NHibernate.dll!NHibernate.Event.Default.DefaultLoadEventListener.DoLoad+0x561 NHibernate.dll!NHibernate.Event.Default.DefaultLoadEventListener.Load+0x3be NHibernate.dll!NHibernate.Event.Default.DefaultLoadEventListener.ProxyOrLoad+0x267 NHibernate.dll!NHibernate.Event.Default.DefaultLoadEventListener.OnLoad+0x8b4 NHibernate.dll!NHibernate.Impl.SessionImpl.FireLoad+0x152 NHibernate.dll!NHibernate.Impl.SessionImpl.InternalLoad+0x155 NHibernate.dll!NHibernate.Type.EntityType.ResolveIdentifier+0x26a NHibernate.dll!NHibernate.Type.ManyToOneType.Assemble+0xff NHibernate.dll!NHibernate.Collection.PersistentBag.InitializeFromCache+0x16c NHibernate.dll!NHibernate.Cache.Entry.CollectionCacheEntry.Assemble+0x66 NHibernate.dll!NHibernate.Event.Default.DefaultInitializeCollectionEventListener.InitializeCollectionFromCache+0xa8d NHibernate.dll!NHibernate.Event.Default.DefaultInitializeCollectionEventListener.OnInitializeCollection+0x56f NHibernate.dll!NHibernate.Impl.SessionImpl.InitializeCollection+0x18c NHibernate.dll!NHibernate.Collection.AbstractPersistentCollection.Initialize+0xf9 NHibernate.dll!NHibernate.Collection.AbstractPersistentCollection.Read+0x35 NHibernate.dll!NHibernate.Collection.Generic.PersistentGenericBag`1.System.Collections.Generic.IEnumerable<T>.GetEnumerator+0x46 This appears to be a race condition, we are using version 3.3.3.GA. I've looked through the source code for a few versions (3.3.3.SP1 and 4.0.0.GA) but the code is the same so I am led to believe this could be a configuration issue rather than a bug in NHibernate. Some googling revealed a similar issue posted on S/O and was fixed: http://stackoverflow.com/questions/26536361/nhibernate-enumerating-the-same-collection-on-multiple-threads Can anyone offer any advice on this at all? -- You received this message because you are subscribed to the Google Groups "nhusers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/nhusers. For more options, visit https://groups.google.com/d/optout.
