Page 1 of 1

NullReferenceException with Distributed Transaction.

Posted: Fri 14 Jan 2011 11:54
by mas
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?

Posted: Mon 17 Jan 2011 08:46
by mas
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();
}

Posted: Mon 17 Jan 2011 18:12
by AndreyR
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?

Posted: Tue 15 Feb 2011 10:42
by s2
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)

Posted: Tue 15 Feb 2011 15:48
by AndreyR
s2, actually, we are still unable to reproduce the problem.
Could you please send us a small test project illustrating the issue?

Posted: Wed 09 Mar 2011 12:33
by mas
I have sent in a test project to illustrate the issue.

Posted: Fri 11 Mar 2011 02:49
by s2
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.

[email protected]

Regards,
S2

Posted: Tue 29 Mar 2011 08:55
by mas
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.

Posted: Thu 07 Apr 2011 11:48
by AndreyR
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.

Posted: Mon 18 Apr 2011 13:02
by mas
I have confirmed that this problem is now fixed by testing my sample application against the new version. Thanks!

Want have a sample project

Posted: Mon 28 Nov 2011 15:12
by Citt_jr
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.