Issue Type: Bug Bug
Affects Versions: 4.1.9, 3.3.0.GA
Assignee: Brett Meyer
Created: 07/Jan/13 10:51 PM
Description:

In a JTA & multi-threaded environment, a timed-out transaction can cause unsafe session access to occur internally in entitymanager.

When AbstractEntityManagerImpl joins a transaction, it registers an "afterCompletionAction" coordinator. If the transaction was rolled back and the session is still open, the coordinator clears the session.

This causes problems in multi-threading within one transaction. If a thread is in the middle of an EntityManager#find, for example, and the transaction times out, a reaper thread will cause the afterCompletionAction and clear the session. Depending on timing, this removes the EntityEntry from the persistenceContext, prior to the fetch attempting to use it. This results in a "possible non-threadsafe access to the session" AssertionFailure.

Project: Hibernate ORM
Priority: Major Major
Reporter: Brett Meyer
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira