NullReferenceException with Distributed Transaction.

NullReferenceException with Distributed Transaction.

Postby mas » Fri 14 Jan 2011 11:54

I am using Devart dotConnect for Oracle Professional 6.0.58.0.

I have an application where Worflows are instantiated from messages from MSMQ. When reading a message from MSMQ, it automatically creates a transaction, probably using TransactionScope.

Within this transaction, we have some custom code that writes to the database. However, we receive the following exception:

Code: Select all
Exception: System.NullReferenceException
Message: Object reference not set to an instance of an object.
StackTrace: at Devart.Common.r.d()
at Devart.Common.r.a(Enlistment A_0)
at System.Transactions.Oletx.OletxVolatileEnlistment.Rollback()
at System.Transactions.Oletx.OletxPhase1VolatileEnlistmentContainer.Aborted()
at System.Transactions.Oletx.OletxTransactionManager.ShimNotificationCallback(Object state, Boolean timeout)
at System.Threading._ThreadPoolWaitOrTimerCallback.PerformWaitOrTimerCallback(Object state, Boolean timedOut)


I have tried to reproduce this in a sample application, however, I was unable to reproduce this problem.

A quick look through Reflector reveals the code below. My feeling is that the Transaction is null, causing the exception.

Code: Select all
public void d()
{
    lock (b.SyncRoot)
    {
        b.Remove(this.c.Transaction.GetHashCode());
    }
}


Does anyone have any idea what the issue is?
mas
 
Posts: 25
Joined: Mon 15 Nov 2010 12:09

Postby mas » Mon 17 Jan 2011 08:46

We found a workaround to this issue, if we create a new TransactionScope with the RequiresNew option, then this error does not occur.

Code: Select all
using (var ts = new TransactionScope(TransactionScopeOption.RequiresNew))
{
   using (var context = new DatabaseEntities())
   {
      // Do database changes...
   }

   ts.Complete();
}
mas
 
Posts: 25
Joined: Mon 15 Nov 2010 12:09

Postby AndreyR » Mon 17 Jan 2011 18:12

Thank you for sharing the workaround.
1. Have you tried to set Transaction Scope Local connection string parameter to true?
2. Could you please send us a small test project illustrating the issue?
AndreyR
Devart Team
 
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Postby s2 » Tue 15 Feb 2011 10:42

Has an actual fix for the problem causing this exception been put into the latest version?

As I have been seeing a very similar exception since moving to 6, with commits rather than rollbacks. I tried 6.00.70, 6.10.96, 6.10.103 and they all exhibit the same failure with the same callstack as shown in the original post. When I remove our transaction code it work fine. When I change back to 5.7 driver I no longer get the exception when I use transactionScopes.

I am also unable to use the RequiresNew TransactionScopeOption as I have a number of operations I need combined into the one transactionScope. We are using MSDTC to manage transactions across multiple databases so we can't set to use local.


Thanks for your help.

-- Exception info --

The error in the exception is - "Object reference not set to an instance of an object."
There seems to be a list with a count of 0 in the exceptions
{System.Collections.ListDictionaryInternal}

-- Here is the stack trace --

Code: Select all
at Devart.Common.x.d()\r\n 
at Devart.Common.x.c(Enlistment A_0)\r\n   at System.Transactions.InternalEnlistment.System.Transactions.IEnlistmentNotificationInternal.Commit(IPromotedEnlistment enlistment)\r\n   at System.Transactions.Oletx.OletxVolatileEnlistment.Commit()\r\n   at System.Transactions.Oletx.OletxPhase1VolatileEnlistmentContainer.Committed()\r\n   at
System.Transactions.Oletx.OletxTransactionManager.ShimNotificationCallback(Object state, Boolean timeout)\r\n   at System.Threading._ThreadPoolWaitOrTimerCallback.PerformWaitOrTimerCallback(Object state, Boolean timedOut)
s2
 
Posts: 2
Joined: Tue 15 Feb 2011 09:34

Postby AndreyR » Tue 15 Feb 2011 15:48

s2, actually, we are still unable to reproduce the problem.
Could you please send us a small test project illustrating the issue?
AndreyR
Devart Team
 
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Postby mas » Wed 09 Mar 2011 12:33

I have sent in a test project to illustrate the issue.
mas
 
Posts: 25
Joined: Mon 15 Nov 2010 12:09

Postby s2 » Fri 11 Mar 2011 02:49

Hi mas,

We've not had any luck fixing this issue.

We've distilled the problem down to a single oracle query and a single mssql query inside a single transaction scope and it throws an exception in the worker process(and sent it to devart).

In the hope that we can narrow the issue down more, would it be possible to get a copy of the sample project that you have created to reproduce the bug in please?

Since I can't PM you, I can be reached at the following address.

lynxit.s2@gmail.com

Regards,
S2
s2
 
Posts: 2
Joined: Tue 15 Feb 2011 09:34

Postby mas » Tue 29 Mar 2011 08:55

I have tested this again with version 6.10.126.0, and I still see the problem. I have updated the test project to illustrate the issue more clearly, and have e-mailed it in.
mas
 
Posts: 25
Joined: Mon 15 Nov 2010 12:09

Postby AndreyR » Thu 07 Apr 2011 11:48

The new build of dotConnect for Oracle 6.10.135 is available for download now. This build fixes the problem.
It can be downloaded from Download Page (trial version) or from Registered Users' Area (for users with valid subscription only).
For more information, please refer to this announcement.
AndreyR
Devart Team
 
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Postby mas » Mon 18 Apr 2011 13:02

I have confirmed that this problem is now fixed by testing my sample application against the new version. Thanks!
mas
 
Posts: 25
Joined: Mon 15 Nov 2010 12:09

Want have a sample project

Postby Citt_jr » Mon 28 Nov 2011 15:12

Hello mas,

We think we have the same problem with an other version of dotConnect for oracle. Unfortunatly, we can't reproduce this bug at our own. Could you send us you project sample please ?

Thank you in advance.
Citt_jr
 
Posts: 6
Joined: Wed 28 Sep 2011 08:44


Return to dotConnect for Oracle