different behaviour in direct=false mode

Discussion of open issues, suggestions and bugs regarding Entity Framework support in ADO.NET Data providers
Post Reply
robymes
Posts: 29
Joined: Tue 09 Sep 2008 09:46

different behaviour in direct=false mode

Post by robymes » Thu 16 Apr 2009 14:40

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

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Fri 17 Apr 2009 12:31

Thank you for the report, we are investigating the problem. I will let you know about the results of our investigation.

chalucha
Posts: 7
Joined: Tue 02 Dec 2008 14:39

Post by chalucha » Tue 13 Oct 2009 12:56

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?

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Wed 14 Oct 2009 13:19

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?

memukesh
Posts: 2
Joined: Thu 22 Oct 2009 20:13
Location: us

Post by memukesh » Thu 22 Oct 2009 20:18

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?

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Mon 26 Oct 2009 15:21

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")?

memukesh
Posts: 2
Joined: Thu 22 Oct 2009 20:13
Location: us

Post by memukesh » Fri 30 Oct 2009 20:20

The issue is not with Direct mode but with indirect mode i.e. through TNSNAMES.ORA

Shalex
Site Admin
Posts: 8245
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Wed 04 Nov 2009 11:52

We have answered you by e-mail.

JonasJ
Posts: 8
Joined: Wed 25 Nov 2009 08:51

Post by JonasJ » Mon 04 Jan 2010 13:28

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?

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Mon 04 Jan 2010 13:48

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();
 }

JonasJ
Posts: 8
Joined: Wed 25 Nov 2009 08:51

Post by JonasJ » Mon 04 Jan 2010 15:20

Thanks for your quick answer!

Post Reply