From: Ian C. (JIRA) <nh...@gm...> - 2010-08-26 16:27:10
|
[ http://216.121.112.228/browse/NH-2182?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=19723#action_19723 ] Ian Clegg commented on NH-2182: ------------------------------- I'm also experiencing this issue with 2.1.2GA (though haven't tried other builds). The exception appears to occur when NHibernate.Impl.Printer is listing the entities during a flush, but encounters an entity that is not loaded in the current session. At this point it initializes a proxy and retrieves it from the database, initializing any non-lazy collections, associations etc. As it iterates it then throws the exception In terms of a workaround we found that ensuring all entities to be flushed were initialized before flushing fixed it. > NHibernate.Event.Default.AbstractFlushingEventListener.AbstractFlushingEventListener() can raise Exception when log is DEBUG > ---------------------------------------------------------------------------------------------------------------------------- > > Key: NH-2182 > URL: http://216.121.112.228/browse/NH-2182 > Project: NHibernate > Issue Type: Bug > Components: Core > Affects Versions: 2.1.2.GA > Reporter: Xavier Le Galles > Priority: Major > > Here is what i get when Log4net is in DEBUG (otherwise there is no exception): > Collection was modified; enumeration operation may not execute. > at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource) > at System.Collections.Generic.Dictionary`2.ValueCollection.Enumerator.MoveNext() > at NHibernate.Impl.Printer.ToString(IEnumerator enumerator, EntityMode entityMode) > at NHibernate.Event.Default.AbstractFlushingEventListener.FlushEverythingToExecutions(FlushEvent event) > at NHibernate.Event.Default.DefaultFlushEventListener.OnFlush(FlushEvent event) > at NHibernate.Impl.SessionImpl.Flush() > at NHibernate.Transaction.AdoTransaction.Commit() > I have checked this method and i found this: > - at the very beginning of the method, you take a reference to IPersistenceContext persistenceContext = session.PersistenceContext > - at the end of the method, if log is in DEBUG: if (log.get_IsDebugEnabled()) > - you try to log the context: new Printer(session.Factory).ToString((IEnumerator) persistenceContext.EntitiesByKey.Values.GetEnumerator(), session.EntityMode); > I have watched the PersistenceContext and yes, it is modified between the beginning and the end of this method: at the beginning, there are 2 entities with no values and at the end 4. Each entity is "doubled" (same ID): one entry has no value, the other one has one. It could be related to the way we calculate the GetHashCode() ... > If you need more details, i could investigate. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://216.121.112.228/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |