Page 1 of 1

different behaviour in direct=false mode

Posted: Thu 16 Apr 2009 14:40
by robymes
I have a very simple test

Code: Select all

[TestMethod]
public void TestMaxNumberOfObjectContetxtInTransactionScope()
{
	using (TransactionScope ts =
		this.GetTransactionScope(TransactionScopeOption.Required, IsolationLevel.ReadCommitted))
	{
		for (int i = 0; i < 33; i++)
		{
			using (TSObjectContext context = new TSObjectContext())
			{                    
				Guid id = Guid.NewGuid();
				string description = Guid.NewGuid().ToString();
				TestData newTestData = TestData.CreateTestData(id);
				newTestData.Description = description;
				context.AddToTestDataSet(newTestData);
				context.SaveChanges();
			}                    
		}
		ts.Complete();
	}
}
33 times is not a guess...
in direct=true mode it works (and it works even with a higher number of times: 200, 500, ...).
in direct=false mode it doesn't work: the maximum number of times is 32 (why 32???) to work properly
The error I get is: ORA-02045: too many local sessions participating in global transaction.
the connection string in direct=false mode refers to a configured service in tsnames.ora file (Oracle client configuration).
Why a so remarkable difference between the two?
I think it's unacceptable: the database is phisically the same, and there are scenarios in which i cannot use the direct=true connection mode (for example an Oracle RAC configuration in load balance, that needs a connection via tsnames.ora with a particular configuration).
I use the latest library (5.00.26).

Posted: Fri 17 Apr 2009 12:31
by AndreyR
Thank you for the report, we are investigating the problem. I will let you know about the results of our investigation.

Posted: Tue 13 Oct 2009 12:56
by chalucha
AndreyR wrote:Thank you for the report, we are investigating the problem. I will let you know about the results of our investigation.
Any news? What caused this?

Posted: Wed 14 Oct 2009 13:19
by AndreyR
We have made several builds with changes in the TransactionScope implementation.
Is the problem reproducible with the latest 5.20.44 build of dotConnect for Oracle?

Posted: Thu 22 Oct 2009 20:18
by memukesh
I have just downloaded 5.25.49.0 and the problem still exists on direct=false mode. Please let me know is there any way I can get rid of this?

What is the problem of using direct=true mode?

Posted: Mon 26 Oct 2009 15:21
by AndreyR
I have just made some simple tests with Direct mode and succeeded.
Could you please make a simple test project to localize the problem and send it to me (support * devart * com, subject "Oracle Tscope")?

Posted: Fri 30 Oct 2009 20:20
by memukesh
The issue is not with Direct mode but with indirect mode i.e. through TNSNAMES.ORA

Posted: Wed 04 Nov 2009 11:52
by Shalex
We have answered you by e-mail.

Posted: Mon 04 Jan 2010 13:28
by JonasJ
I am also experiencing this error when working with an Orcale 9 dbms. Due to load balancing direct mode is not an option.

Any chance you can post or mail me the answer?

Posted: Mon 04 Jan 2010 13:48
by AndreyR
This is an internal Oracle server limitation. Maximum number of branches in the distributed Oracle transaciton is 32.
Our TransactionScope implementation uses distributed transactions.
Direct mode emulates this behaviour, so there is no such limitation.
If you don't need TransactionScope, I recommend you to use local transactions
using the ObjectContext.Connection. BeginTransaction method.

Code: Select all

context.Connection.Open();
DEPT department = context.DEPT.Where(d => d.DEPTNO == 10).First();
department.LOC = "TEST";
using (System.Data.Common.DbTransaction transaction =    context.Connection.BeginTransaction()) {        
  context.SaveChanges();
  department.DNAME = "TEST";
  context.SaveChanges();
  if(flag)
    transaction.Commit();
  else 
    transaction.Rollback();
 }

Posted: Mon 04 Jan 2010 15:20
by JonasJ
Thanks for your quick answer!