Description:
|
In a JTA & multi-threaded environment, a timed-out transaction can cause unsafe session access to occur internally in
entitymanager
ORM
.
When AbstractEntityManagerImpl joins a transaction, it registers an "afterCompletionAction" coordinator. If the transaction
was
is
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
kick off
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.
|