OraDirect threading bug

OraDirect threading bug

Postby JerryJVL » Wed 22 Aug 2007 06:30

The following code has a problem; the 'first connection' is established normally, but the 'second connection' fails with a session timeout.

This problem only occurs when opening connections on two different threads and only under OraDirect. When using ODP.NET with this same code (comment out CoreLab using clause and put in Oracle.DataAccess using clause) it works just fine.

Something inside OraDirect seems to cause a problem in this scenario.
Code: Select all
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
using CoreLab.Oracle;
//using Oracle.DataAccess.Client;

namespace ConsoleApplication8
{
  class Program
  {
    static private OracleConnection _conn1;
    static private OracleConnection _conn2;
    static private string _connectionString = "User Id=pss;Password=pss;Data Source=NEMT14;Pooling=false";

    static private void Method()
    {
      Console.WriteLine("{0:HH-mm-ss}: Making second connection", DateTime.Now);
      try
      {
        _conn2 = new OracleConnection(_connectionString);
        _conn2.Open();
        Console.WriteLine("{0:HH-mm-ss}: Established second connection", DateTime.Now);
      }
      catch (Exception ex)
      {
        Console.WriteLine("{0:HH-mm-ss}: Second connection failed\n{1}", DateTime.Now, ex.ToString());
      }
    }

    static private void Runner()
    {
      while (true)
      {
        Thread.Sleep(1000);

        Method();

        Thread.Sleep(1000000);
      }
    }

    static void Main(string[] args)
    {
      Console.WriteLine("{0:HH-mm-ss}: Making first connection", DateTime.Now);
      _conn1 = new OracleConnection(_connectionString);
      _conn1.Open();
      Console.WriteLine("{0:HH-mm-ss}: Established first connection", DateTime.Now);

      Thread thread = new Thread(Runner);
      thread.IsBackground = true;
      thread.Start();

      Console.ReadLine();
    }
  }
}
JerryJVL
 
Posts: 6
Joined: Wed 22 Aug 2007 05:42

OraDirect version...

Postby JerryJVL » Wed 22 Aug 2007 06:31

I should have mentioned as well... I'm using OraDirect 4.0.16 (latest version as far as I can tell).
JerryJVL
 
Posts: 6
Joined: Wed 22 Aug 2007 05:42

Postby Alexey » Wed 22 Aug 2007 07:29

I can't reproduce any problem. What are your versions of Oracle server and Oracle client?
Alexey
 
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Postby JerryJVL » Thu 23 Aug 2007 00:03

As far as I can tell, Oracle 9i client 9.2.0.1 and server 9.2.0.6. What version of the client did you try under?
JerryJVL
 
Posts: 6
Joined: Wed 22 Aug 2007 05:42

Postby JerryJVL » Thu 23 Aug 2007 00:08

Also note again that when I use ODP.NET to execute the exact same code it functions perfectly. When I run with OraDirect I get the following output though:
Code: Select all
10-05-38: Making first connection
10-05-40: Established first connection
10-05-41: Making second connection
10-06-53: Second connection failed
CoreLab.Oracle.OracleException: ORA-12535: TNS:operation timed out
   at CoreLab.Oracle.OracleConnection.Open()
   at ConsoleApplication8.Program.Method() in C:\NEMMCO.NET2\TmpTestApps\Console Application8\Program.cs:line 23


The problem I have is that I am trying to convince management to use OraDirect instead of ODP.NET, but it will be extremely difficult for me to make a case when OraDirect is preceived as not to work when ODP.NET does so without a flaw.
JerryJVL
 
Posts: 6
Joined: Wed 22 Aug 2007 05:42

Postby Alexey » Thu 23 Aug 2007 07:06

I've tried this on Oracle 10g and Oracle 9.2.0.6 with Oracle client 10. No problem.
Do you experience same problem when using direct mode?
We need additional time to investigate your inquiry carefully.
Look forward to hearing from me again.
Alexey
 
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Postby Alladin » Fri 24 Aug 2007 17:21

Alexey, did you try to test this code on real multiprocessor box (dual/quad core)?
Alladin
 
Posts: 149
Joined: Mon 27 Nov 2006 16:18

Postby Alexey » Mon 27 Aug 2007 08:26

Yes, we have tested this code on a dual core Intel box and could not reproduce any problem.
Alexey
 
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Postby JerryJVL » Wed 05 Sep 2007 00:16

The problem definitely exists here in our environment; I'll see if I can set up a test environment with Oracle 10 client to see if there is a difference. Even if it does make a difference I'm not sure that I can get all our servers moved to Oracle 10 though.

Again note that I am certain this is not an issue inherent in our Oracle client version though, because when I run the exact same code with ODP.NET on the exact same machine in the exact same enviromenment (even at exactly the same time as the OraDirect version!) the ODP.NET bound version succeeds and the OraDirect version fails.

I can understand it's frustrating for you that you cannot reproduce my problem. Are there any environment details (or versions) that I could provide you with that might assist in recreating the problem?
JerryJVL
 
Posts: 6
Joined: Wed 22 Aug 2007 05:42

Postby Alexey » Thu 06 Sep 2007 10:15

Could you stop hanged process and sent me its call stack? (Mind that "Enable debug just my code" option in VS 2005 should be turned off.)
Use email address provided in the Readme.txt file.
Alexey
 
Posts: 2756
Joined: Mon 13 Mar 2006 07:43


Return to dotConnect for Oracle