Warning: Can't synchronize with repository "(default)" (/home/git/ome.git does not appear to be a Git repository.). Look in the Trac log for more information.
Notice: In order to edit this ticket you need to be either: a Product Owner, The owner or the reporter of the ticket, or, in case of a Task not yet assigned, a team_member"

Bug #509 (closed)

Opened 17 years ago

Closed 17 years ago

Sessions from StatefulServices not being freed.

Reported by: jamoore Owned by: jamoore
Priority: critical Cc:
Sprint: n.a.
Total Remaining Time: n.a.

Description

The SessionHandler code is not properly freeing sessions from stateful services while running in the AS. This is caused (at least in part) by attempts to close the connection, which is disallowed when in a managed transaction. An exception was being swallowed, which is why this wasn't being seen. Unclear if the same happens outside of the AS.

Change History (5)

comment:1 Changed 17 years ago by jmoore

r1094 adds tests. The test which invokes close() passes. There are still issues when close() is not evoked possibly due to destroy() being called in the passivation thread.

comment:2 Changed 17 years ago by jmoore

To reproduce:

  1. Call connectionsShouldBeFreeOnTimeout(). Should pass.
  2. Call it again. This time all calls should fail with the exception:
    11:01:25,997 INFO  [ServiceHandler] Excp:       org.springframework.orm.hibernate3.HibernateObjectRetrievalFailureException: No row with the given identifier exists: [ome.model.core.OriginalFile#30]; nested exception is org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [ome.model.core.OriginalFile#30]
    

The IUpdate call is returning an OriginalFile with id, but that id is not in the database, although the two calls take place in two different transactions. Another exception is being thrown:

11:01:25,343 ERROR [TransactionSynchronizationUtils] TransactionSynchronization.beforeCompletion threw exception
java.lang.IllegalStateException: No value for key [org.hibernate.impl.SessionFactoryImpl@3d9061ec] bound to thread [SocketServerInvokerThread-127.0.1.1-11]
        at org.springframework.transaction.support.TransactionSynchronizationManager.unbindResource(TransactionSynchronizationManager.java:179)
        at org.springframework.orm.hibernate3.SpringSessionSynchronization.beforeCompletion(SpringSessionSynchronization.java:178)

which perhaps is somehow killing the previous transaction out of turn. (Is an exception being eaten?)

comment:3 Changed 17 years ago by jmoore

http://opensource.atlassian.com/projects/spring/browse/SPR-2883 opened with Spring. The call to saveAndReturnObject() should actually be throwing an exception not returning a value. Now it's just a matter of finding out why unbindResource() is throwing the IllegalStateException.

comment:4 Changed 17 years ago by jmoore

  • Keywords changed from threading, connections to threading, connections, REVIEW, DOCUMENT

r1109 corrects this. Sessions as well as transactions are now freed. A general reworking of the SessionHandler was necessary. In addition, a workaround/"hack" was necessary to keep Spring happy: after a method call, Spring always tries to remove the session from thread (being tidy), but we wanted to forcefully remove it. Therefore, we place a DUMMY session in the thread, which Spring is allowed to remove. HOWEVER, sometimes, because of the call graph, the DUMMY doesn't get removed, in which case ServiceHandler has to do some cleanup.

Documentation on all of that coming.

comment:5 Changed 17 years ago by jmoore

  • Resolution set to fixed
  • Status changed from new to closed
Note: See TracTickets for help on using tickets. You may also have a look at Agilo extensions to the ticket.

1.3.13-PRO © 2008-2011 Agilo Software all rights reserved (this page was served in: 0.63290 sec.)

We're Hiring!