none
{"Unable to get error message (6107) (0)."} ??

    Question

  • Hello everybody,
    i'm using System.Data.OracleClient version 2.0.0.0 and TransactionScope class to perform a long transaction (more than 10 minutes) in an Oracle 10 database.

    After some time i get this error:

    {"Unable to get error message (6107) (0)."}

    and here's the stacktrace.

     at System.Data.OracleClient.OracleInternalConnection.Enlist(String userName, String password, String serverName, Transaction transaction, Boolean manualEnlistment)
       at System.Data.OracleClient.OracleInternalConnection.Activate(Transaction transaction)
       at System.Data.ProviderBase.DbConnectionInternal.ActivateConnection(Transaction transaction)
       at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
       at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
       at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
       at System.Data.OracleClient.OracleConnection.Open()
       at Microsoft.Practices.EnterpriseLibrary.Data.Database.OpenConnection()
       at Microsoft.Practices.EnterpriseLibrary.Data.Database.ExecuteNonQuery(DbCommand command)
       at ABB.KBS.SM.DataAccessObjects.SMCollectionDAO.Save(ISMStruct t)

    My machine is Win XP SP2.

    I'm using enterprise library to get the connection to the database and i have read that this error can be caused by a large number of connections. But i also know that enterprise library doesn't create a new connection for each "INSERT" right?

    What i have tried so far:

    Changing the TransactionScope Timeout -> doesn't work.
    Changing the maxTimeout attribute in machine.config -> doesn't work.


    I've seen similar discussion about this, but i have found any other solution, i just wanted to know if somebody else has encoutered this problem and found a solution/workaround/hack  to solve it.

    Thanks and best regards.
    Tuesday, October 14, 2008 9:48 AM

Answers

  • OK, the problem seems solved.

    After reading a lot on transaction timeouts i will try to clarify:

    If no timeout is specified in the TransactionScope constructor, a transaction has 1 min timeout by default.
    This timeout can be overridden in the app.config (or web.config ) by adding following lines.

    //this is actually my web.config
    <system.transactions>
       <defaultSettings timeout="00:30:00" />
    </system.transactions>

    Anyway, to prevent too long transactions, a maximum timeout can be specified at machine.config level by setting


    //this is my machine.config
    <system.transactions>
       <machineSettings maxTimeout="00:30:00" />
    </system.transactions>

    If this is not specified explicitely, the maxTimeout has a default value of 10 minutes.

    So at the end my code looks like (cannot put code snippet, this editor is not so good with Firefox maybe ):

    try
    {

    //i set no timeout in the constructor
    using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required))
    {
    Console.WriteLine("Started loop at " + DateTime.Now);
    do
    {

    //make something on the db...
    }
    while (true);
    }
    }
    catch (Exception ex)
    {
    Console.WriteLine("Aborted loop at " + DateTime.Now);
    Console.WriteLine(ex.Message);
    Console.WriteLine(ex.StackTrace);
    }


    And i could complete the transaction after more or less 15 minutes.

    Of course changing the machine.config will affect every transaction, but at least in my case i can accept it.

    Ciao!



    Friday, October 17, 2008 9:01 AM

All replies

  • Changing timeout wouldn't work for this issue... Please refer one of msdn forum: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1625639&SiteID=1

     

    The errors seemed to be thrown from Oracle server:

    http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=883692&SiteID=1

     

    Possible solution:

    It seems that if you run your code not on Win XP SP2 machine would work.

    Wednesday, October 15, 2008 2:59 AM
    Answerer
  • Hi,
    thanks for the reply, but i made a test on a Win2003 machine and i got the same exception.

    I also made a simple application that makes an infinite loop and tries to perform an operation in the database in the same transaction.

    Code Snippet

    try
    {
    using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required,
    new TimeSpan(0, 20, 0)))
    {
    Console.WriteLine("Started loop at " + DateTime.Now);
    do
    {

    //make something on the db...

    SMBLRetriever.GetMatrixBL().Save(matrix);
    }
    while (true);
    }
    }
    catch (Exception ex)
    {
    Console.WriteLine("Aborted loop at " + DateTime.Now);
    Console.WriteLine(ex.Message);
    Console.WriteLine(ex.StackTrace);
    }


    Even if the timeout is set to 20 minutes, after 10 minutes i get this stacktrace:
    Code Snippet

    Unable to get error message (6107) (0).
    at System.Data.OracleClient.OracleException.Check(Int32 rc, OracleInternalConnection internalConnection)
    at System.Data.OracleClient.OciEnlistContext.Join(OracleInternalConnection internalConnection, Transaction indigoTransaction)
    at System.Data.OracleClient.OracleInternalConnection.Enlist(String userName, String password, String serverName, Transaction transaction,
    Boolean manualEnlistment)
    at System.Data.OracleClient.OracleInternalConnection.Activate(Transaction transaction)
    at System.Data.ProviderBase.DbConnectionInternal.ActivateConnection(Transaction transaction)
    at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
    at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
    at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
    at System.Data.OracleClient.OracleConnection.Open()
    at Microsoft.Practices.EnterpriseLibrary.Data.Database.OpenConnection()
    at Microsoft.Practices.EnterpriseLibrary.Data.Database.ExecuteNonQuery(DbCommand command)
    at ABB.KBS.SM.DataAccessObjects.SMMatrixDAO.Save(ISMStruct s)
    at ABB.KBS.SM.BL.SMBaseBL.Save(ISMStruct s)


    If the timeout is set to a value > 10 minutes, it doesn't care.

    I found this discussion about timeouts, have a look.

    Thanks



    Wednesday, October 15, 2008 4:50 PM
  • Hmm, I couldn't repro the issue you have.... My machine is Windows Server 2003 SP2. I basically use your code pattern and run through it for at least 30 minutes now but still not seeing errors. Perhaps I don't use Microsoft.Practices.EnterpriseLibrary.Data class? Can you try to directly call System.Data.OracleClient for retrieving data to see if problem go away?

     

    Thursday, October 16, 2008 5:34 PM
    Answerer
  • OK, the problem seems solved.

    After reading a lot on transaction timeouts i will try to clarify:

    If no timeout is specified in the TransactionScope constructor, a transaction has 1 min timeout by default.
    This timeout can be overridden in the app.config (or web.config ) by adding following lines.

    //this is actually my web.config
    <system.transactions>
       <defaultSettings timeout="00:30:00" />
    </system.transactions>

    Anyway, to prevent too long transactions, a maximum timeout can be specified at machine.config level by setting


    //this is my machine.config
    <system.transactions>
       <machineSettings maxTimeout="00:30:00" />
    </system.transactions>

    If this is not specified explicitely, the maxTimeout has a default value of 10 minutes.

    So at the end my code looks like (cannot put code snippet, this editor is not so good with Firefox maybe ):

    try
    {

    //i set no timeout in the constructor
    using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required))
    {
    Console.WriteLine("Started loop at " + DateTime.Now);
    do
    {

    //make something on the db...
    }
    while (true);
    }
    }
    catch (Exception ex)
    {
    Console.WriteLine("Aborted loop at " + DateTime.Now);
    Console.WriteLine(ex.Message);
    Console.WriteLine(ex.StackTrace);
    }


    And i could complete the transaction after more or less 15 minutes.

    Of course changing the machine.config will affect every transaction, but at least in my case i can accept it.

    Ciao!



    Friday, October 17, 2008 9:01 AM
  • Hi,

    I was having same problem, it solved by changing a SELECT SQL statment in transaction scope 

    Problem

      string sQuery = string.Format("SELECT TOP 1 ID FROM TBL.MYTABLE WHERE NOMBRE ={0}",Nombre);

    solution 

      string sQuery = string.Format("SELECT TOP 1 ID FROM TBL.MYTABLE WHERE NOMBRE ='{0}'",Nombre);

    // adding single quotes

    look for som Select like this scenario, in my case it was causing the issue and was resolved this way, sorry for my english  :)

    Wednesday, March 30, 2016 8:00 PM