Forum Stats

  • 3,816,521 Users
  • 2,259,200 Discussions


Detect In-Doubt Transactions using

user8960976 Member Posts: 27
edited Mar 19, 2015 4:51AM in ODP.NET

I was hit by a successful 2pc that wasn't materialized in Oracle. The other participant was MSMQ which materialized fine. The application flow is very simple:

1. get messge from MSMQ
2. insert row in Oracle
3. commit queue and Oracle with 2pc.

The message was processed and deleted but the row was not found in Oracle.

Later I found the missing rows held by In-Doubt Transactions in sys.dba_2pc_pending.
I'm using C# in NServicebus which handles the transaction scoping.

Could I somehow have detected this in my application?



  • Alex Keh-Oracle
    Alex Keh-Oracle Posts: 3,062 Employee
    edited Mar 16, 2015 1:23PM

    Are you using unmanaged ODP.NET? If so, are you using Oracle Services for MTS for your distributed transactions with the Microsoft DTC?

    If NServiceBus is the one integrating with the MS DTC to coordinate the transaction, then you'd want to follow up with Particular Software on why the committed transaction remains in-doubt.

  • user8960976
    user8960976 Member Posts: 27
    edited Mar 17, 2015 11:17AM

    Many thanks for the response.

    Yes we are using unmanaged ODP:NET and both MTS and MS DTC is running. Since the first enlisted participant is MSMQ i guess that the coordinate would be MS DTC.

    I will write Particular Software but I find it very unlikely that they would swallow an Exception, if that is what you mean?

  • Alex Keh-Oracle
    Alex Keh-Oracle Posts: 3,062 Employee
    edited Mar 17, 2015 1:59PM

    The key question is which service is coordinating the transaction. Is it OraMTS, is it NServiceBus, or something else? The exception should be propagated from that service.

  • user8960976
    user8960976 Member Posts: 27
    edited Mar 19, 2015 4:51AM

    I will write Particular Software today, but since there are 3 parts (NServicebus, Oracle, my code) it gonna be hard to hunt down the root cause..

    I expect the NServicebus engine to do something like this (this sample does a MSMQ send instead of read - should be the same)

            public void Test()


                //create queue

                var queueName = @.\Private$\testqueue;

                var mq = new MessageQueue();

                if (!MessageQueue.Exists(queueName))

                    MessageQueue.Create(queueName, true);

                mq.Path = queueName;

                using (TransactionScope ts = new TransactionScope())


                    mq.Send("test", MessageQueueTransactionType.Automatic);


                    //unmanaged insert SQL here.




    Should this code throw an Exception, when the transaction ends in the sys.dba_2pc_pending view?

    And why is it that the RECO service doesn't recover the pending 2pc? My service (the NServicebus host) is still running.

This discussion has been closed.