[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-7265) ConcurrentModificationException in SynchronizationRegistryImpl.notifySynchronizationsAfterTransactionCompletion due to SynchronizationRegistryImpl.clearSynchronizations clearing SynchronizationRegistryImpl.synchronizations

Scott Marlow (JIRA) noreply at atlassian.com
Fri Apr 27 08:14:49 EDT 2012


    [ https://hibernate.onjira.com/browse/HHH-7265?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=46443#comment-46443 ] 

Scott Marlow commented on HHH-7265:
-----------------------------------

I haven't reviewed the patch yet but wanted to share an even hackier way to possibly fix. ;)

How about if we hacked the synchronizations so that the EntityManager.close is always last (via some hack logic that keeps the EM.close at the end of the list).  Currently, the iteration order will be the order that the synchronizations were added.  

I think a cleaner fix would be to add a new method to SynchronizationRegistry:
{code}
	/**
	 * Register a system {@link Synchronization} level callback for this transaction.  System level synchronizations will run user-system level synchronizations have run.
	 *
	 * @param synchronization The synchronization callback to register.
	 *
	 * @throws org.hibernate.HibernateException
	 */
	public void registerSystemSynchronization(Synchronization synchronization);
{code}

I assume we aren't changing the SPI now but this might be one way to address this (when the SPI can change).  The current registerSynchronization(Synchronization) method could be hacked to put the passed Synchronization on a different list (or keep it at the end of an arraylist) until we make the SPI change.



> ConcurrentModificationException in SynchronizationRegistryImpl.notifySynchronizationsAfterTransactionCompletion due to SynchronizationRegistryImpl.clearSynchronizations clearing SynchronizationRegistryImpl.synchronizations
> ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HHH-7265
>                 URL: https://hibernate.onjira.com/browse/HHH-7265
>             Project: Hibernate ORM
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 4.1.2
>         Environment: AS7 7.1.1 
>            Reporter: Scott Marlow
>            Assignee: Gail Badner
>             Fix For: 4.1.3
>
>         Attachments: hibernatesearchsync.jpg
>
>
> forum post link here includes the AS7 test case and description https://community.jboss.org/thread/197649?start=0&tstart=0
> http://pastie.org/3819424 is the call stack showing SynchronizationRegistryImpl.notifySynchronizationsAfterTransactionCompletion looping on synchronization which is cleared mid-loop by SynchronizationRegistryImpl.clearSynchronizations

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list