Yes, both pooling and OraMTS are enabled. We have tried reinstalling COM+ and MSDTC too. But no luck.

I've seen the link that you mentioned. But it does not help much. It is mainly to avoid leaking connections - if we don't use NH transactions within transactionscope, then it leaks connections. Unfortunately for us we don't reach that stage at all. Exception occurs before end of transactionScope block.

On , Juan <[email protected]> wrote:
Hmm... connection pooling and oraclemts winservice enabled?



Also, have you seen this? It might be related

http://davybrion.com/blog/2010/05/avoiding-leaking-connections-with-nhibernate-and-transactionscope/





On Feb 22, 1:41 am, Samir [email protected]> wrote:

> Hi Juan,

>

> It was mistake in my mail. We do have TransactionScope.complete() just

> before end of using block. Problem is it does not reach there at all.

> The exception occurs before that - second session.flush().

>

> Regards,

> Samir

>

> On Feb 22, 11:13 am, Juan [email protected]> wrote:

>

> > Since you didn't call transactioscope.complete(), it is trying to

> > rollback the SQL insert/updates issued by session.flush(), but since

> > the session is gone, it can't

>

> > On Feb 19, 7:33 am, Samir [email protected]> wrote:

>

> > > We are having an application which is working file in development

> > > environment, but in the test environment, we get an exception whenever

> > > we try to perform second operation within a transaction scope.

> > > Pseudocode that is causing the issue:

>

> > > using (TransactionScope tScope = new TransactionScope())

> > > {

> > > using (ISession session = sessionFactory.OpenSession())

> > > {

> > > session.SaveOrUpdate(obj1); // some transient obj

> > > session.Flush();

> > > }

>

> > > using (ISession session = sessionFactory.OpenSession())

> > > {

> > > session.SaveOrUpdate(obj2); // some another transient obj

> > > session.Flush(); // Exception occurs here

> > > }

>

> > > }

>

> > > The exception that occurs:

>

> > > Message: Error has occured in service:

> > > System.Transactions.TransactionException: The operation is not valid

> > > for the state of the transaction.

> > > at

> > > System.Transactions.TransactionState.EnlistVolatile(InternalTransaction

> > > tx, IEnlistmentNotification enlistmentNotification, EnlistmentOptions

> > > enlistmentOptions, Transaction atomicTransaction)

> > > at

> > > System.Transactions.Transaction.EnlistVolatile(IEnlistmentNotification

> > > enlistmentNotification, EnlistmentOptions enlistmentOptions)

> > > at

> > > NHibernate.Transaction.AdoNetWithDistributedTransactionFactory.EnlistInDist ributedTransactionIfNeeded(ISessionImplementor

> > > session)

> > > at

> > > NHibernate.Impl.AbstractSessionImpl.EnlistInAmbientTransactionIfNeeded()

> > > at

> > > NHibernate.Impl.AbstractSessionImpl.CheckAndUpdateSessionStatus()

> > > at NHibernate.Impl.SessionImpl.get_Batcher()

> > > at NHibernate.Type.DbTimestampType.UsePreparedStatement(String

> > > timestampSelectString, ISessionImplementor session)

> > > at

> > > NHibernate.Type.DbTimestampType.GetCurrentTimestamp(ISessionImplementor

> > > session)

> > > at NHibernate.Type.DbTimestampType.Seed(ISessionImplementor

> > > session)

> > > at NHibernate.Type.TimestampType.Next(Object current,

> > > ISessionImplementor session)

> > > at NHibernate.Engine.Versioning.Increment(Object version,

> > > IVersionType versionType, ISessionImplementor session)

> > > at

> > > NHibernate.Event.Default.DefaultFlushEntityEventListener.GetNextVersion(Flu shEntityEvent

> > > event)

> > > at

> > > NHibernate.Event.Default.DefaultFlushEntityEventListener.ScheduleUpdate(Flu shEntityEvent

> > > event)

> > > at

> > > NHibernate.Event.Default.DefaultFlushEntityEventListener.OnFlushEntity(Flus hEntityEvent

> > > event)

> > > at

> > > NHibernate.Event.Default.AbstractFlushingEventListener.FlushEntities(FlushE vent

> > > event)

> > > at

> > > NHibernate.Event.Default.AbstractFlushingEventListener.FlushEverythingToExe cutions(FlushEvent

> > > event)

> > > at

> > > NHibernate.Event.Default.DefaultFlushEventListener.OnFlush(FlushEvent

> > > event)

> > > at NHibernate.Impl.SessionImpl.Flush()

>

> > > We have checked that MSDTC is running fine. On test server, if we use

> > > plain OracleConnection class within TransactionScope, then code is

> > > working fine. Issue occurs when using NHibernate session only. We are

> > > using:

>

> > > NHibernate 3.0.0

> > > Oracle Client 11.2.0.1

> > > .NET 3.5 SP1

>

> > > In the nhibernate logs, following are the last few lines when

> > > transaction is suddenly rolled back without any error in the log:

>

> > > 2011-02-19 19:54:38,155 [9] DEBUG NHibernate.AdoNet.AbstractBatcher -

> > > ExecuteNonQuery took 1 ms

> > > 2011-02-19 19:54:38,155 [9] DEBUG NHibernate.AdoNet.AbstractBatcher -

> > > Closed IDbCommand, open IDbCommands: 0

> > > 2011-02-19 19:54:38,170 [9] DEBUG

> > > NHibernate.Persister.Collection.ICollectionPersister - done deleting

> > > collection

> > > 2011-02-19 19:54:38,170 [9] DEBUG

> > > NHibernate.Persister.Collection.ICollectionPersister - Inserting

> > > collection: [XXX.BusinessEntities.RolePlayer.PartyNameList#843]

> > > 2011-02-19 19:54:38,186 [9] DEBUG

> > > NHibernate.Persister.Collection.ICollectionPersister - collection was

> > > empty

> > > 2011-02-19 19:54:38,186 [9] DEBUG NHibernate.AdoNet.ConnectionManager

> > > - registering flush end

> > > 2011-02-19 19:54:38,201 [9] DEBUG

> > > NHibernate.Event.Default.AbstractFlushingEventListener - post flush

> > > 2011-02-19 19:54:38,201 [9] DEBUG NHibernate.Impl.SessionImpl -

> > > [session-id=4391a921-5624-4552-bfa4-13b87f92b6cc] running

> > > ISession.Dispose()

>

> > > ------- Here the first session is complete and second start starts

> > > within same TransactionScope

>

> > > 2011-02-19 19:54:38,217 [9] DEBUG NHibernate.Impl.SessionImpl -

> > > [session-id=5b33510a-593c-464c-98d9-f01eb52dce24] opened session at

> > > timestamp: 634337420782, for session factory: [/

> > > b72244cfece246d985ae4d4a2bbd9bd3]

> > > 2011-02-19 19:54:38,217 [9] DEBUG NHibernate.Impl.AbstractSessionImpl

> > > - enlisted into DTC transaction: Serializable

> > > 2011-02-19 19:54:38,233 [9] DEBUG NHibernate.Engine.VersionValue -

> > > version unsaved-value strategy UNDEFINED

> > > 2011-02-19 19:54:38,248 [9] DEBUG NHibernate.Engine.IdentifierValue -

> > > unsaved-value: 0

> > > 2011-02-19 19:54:38,248 [9] DEBUG

> > > NHibernate.Event.Default.AbstractSaveEventListener - transient

> > > instance of: XXX.BusinessEntities.ScreenSectionConfirmation

> > > 2011-02-19 19:54:38,264 [9] DEBUG

> > > NHibernate.Event.Default.DefaultMergeEventListener - merging transient

> > > instance

> > > 2011-02-19 19:54:38,280 [9] DEBUG NHibernate.AdoNet.AbstractBatcher -

> > > Opened new IDbCommand, open IDbCommands: 1

> > > 2011-02-19 19:54:38,280 [9] DEBUG NHibernate.AdoNet.AbstractBatcher -

> > > Building an IDbCommand object for the SqlString: select

> > > SEQ_SCR_SECTION_CONFIRM_ID.nextval from dual

> > > 2011-02-19 19:54:38,295 [9] DEBUG NHibernate.SQL - select

> > > SEQ_SCR_SECTION_CONFIRM_ID.nextval from dual

> > > 2011-02-19 19:54:38,295 [9] DEBUG

> > > NHibernate.Connection.DriverConnectionProvider - Obtaining

> > > IDbConnection from Driver

> > > 2011-02-19 19:54:38,436 [9] DEBUG NHibernate.Impl.SessionImpl -

> > > transaction completion

> > > 2011-02-19 19:54:38,436 [9] DEBUG NHibernate.AdoNet.ConnectionManager

> > > - aggressively releasing database connection

> > > 2011-02-19 19:54:38,451 [9] DEBUG

> > > NHibernate.Connection.ConnectionProvider - Closing connection

> > > 2011-02-19 19:54:38,451 [9] DEBUG NHibernate.Impl.AbstractSessionImpl

> > > - rolled back DTC transaction

> > > 2011-02-19 19:54:38,467 [9] DEBUG NHibernate.Impl.SessionImpl -

> > > transaction completion

> > > 2011-02-19 19:54:38,467 [9] DEBUG NHibernate.AdoNet.ConnectionManager

> > > - aggressively releasing database connection

> > > 2011-02-19 19:54:38,483 [9] DEBUG NHibernate.Impl.AbstractSessionImpl

> > > - rolled back DTC transaction

> > > 2011-02-19 19:54:38,483 [9] DEBUG NHibernate.Impl.SessionImpl -

> > > transaction completion

> > > 2011-02-19 19:54:38,498 [9] DEBUG NHibernate.AdoNet.ConnectionManager

> > > - aggressively releasing database connection

> > > 2011-02-19 19:54:38,498 [9] DEBUG NHibernate.Impl.SessionImpl -

> > > [session-id=4391a921-5624-4552-bfa4-13b87f92b6cc] executing real

> > > Dispose(True)

> > > 2011-02-19 19:54:38,514 [9] DEBUG NHibernate.Impl.SessionImpl -

> > > closing session

> > > 2011-02-19 19:54:38,514 [9] DEBUG NHibernate.AdoNet.AbstractBatcher -

> > > running BatcherImpl.Dispose(true)

> > > 2011-02-19 19:54:38,530 [9] DEBUG NHibernate.Impl.SessionImpl -

> > > transaction completion

> > > 2011-02-19 19:54:38,545 [9] DEBUG NHibernate.AdoNet.ConnectionManager

> > > - aggressively releasing database connection

> > > 2011-02-19 19:54:38,561 [9] DEBUG NHibernate.Impl.AbstractSessionImpl

> > > - enlisted into DTC transaction: Serializable

> > > 2011-02-19 19:54:38,561 [9] DEBUG NHibernate.Impl.SessionImpl -

> > > transaction completion

> > > 2011-02-19 19:54:38,576 [9] DEBUG NHibernate.AdoNet.ConnectionManager

> > > - aggressively releasing database connection

> > > 2011-02-19 19:54:38,576 [9] DEBUG NHibernate.Impl.SessionImpl -

> > > [session-id=5b33510a-593c-464c-98d9-f01eb52dce24] running

> > > ISession.Dispose()

> > > 2011-02-19 19:54:38,592 [9] DEBUG NHibernate.Impl.SessionImpl -

> > > [session-id=5b33510a-593c-464c-98d9-f01eb52dce24] executing real

> > > Dispose(True)

> > > 2011-02-19 19:54:38,592 [9] DEBUG NHibernate.Impl.SessionImpl -

> > > closing session

> > > 2011-02-19 19:54:38,608 [9] DEBUG NHibernate.AdoNet.AbstractBatcher -

> > > running BatcherImpl.Dispose(true)

> > > 2011-02-19 19:54:38,608 [9] DEBUG NHibernate.AdoNet.AbstractBatcher -

> > > Closed IDbCommand, open IDbCommands: 0



--

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.



--
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