I have done a bit more testing and sometimes I get 3 threads hitting
the one session when I use sessions. As the session is not thread
safe, this often causes strange behavior, such as disconnecting a
connection that has just been open for the next job, or modifying a
list while the other thread is enumerating it.

I think the best solution is to always use a session per transaction.
That will avoid most of the issues. But I still find I get the
occasional exception from multiple threads hitting
StatefulPersistenceContext.AfterTransactionCompletion. I put a lock in
SessionImpl.AfterTransactionCompletion which fixed that. Although I
would prefer not to modify the source code .... any ideas?

On Apr 15, 10:20 pm, Iain <[email protected]> wrote:
> I think I am having the same issue. I have noticed that I sometimes
> get an exception on another thread. The other thread seems to be setup
> by the distributed transaction.
>
> Perhaps try the code I pasted into my issue and see what happens 
> ...http://groups.google.com/group/nhusers/browse_thread/thread/de1e4fc82...
>
> Option 2, do you mean create a new session for each transaction? That
> is a good idea to me. I have been unable to use the same session, as
> randomly the session decides it cannot disconnect as the transaction
> has not been commited.
>
> On Apr 15, 7:21 pm, Norman <[email protected]> wrote:
>
>
>
> > This seems to be an NHibernate bug that is specific to Oracle.
>
> > I've raised a Jira (NH-2176) for this and provided a failing unit
> > test:
>
> >http://216.121.112.228/browse/NH-2176

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to