Attempted to read or write protected memory using TransactionScope and Oracle 10g Client.

O

OUSoonerTaz

We are randomly getting this error message on our development and
staging machines:

Attempted to read or write protected memory. This is often an
indication that other memory is corrupt.; at
System.Data.Common.UnsafeNativeMethods.OraMTSJoinTxn(OciEnlistContext
pCtxt, IDtcTransaction pTrans)
at
System.Data.OracleClient.TracedNativeMethods.OraMTSJoinTxn(OciEnlistContext
pCtxt, IDtcTransaction pTrans)
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()

We are using VS2005, C#, Oracle 10g Client, and the TransactionScope.
When we get this error, it's usually either on the opening of the
connection OR on the execution of the proc/package. We had to install
the client, then install, as a separate package the oracle support for
MTS which supports transactions.

Here is a snippet of code that causes this error:

using (TransactionScope scope = new TransactionScope())
{
using (IDbConnection connection = this.GetConnection())
{
connection.Open();
...DO SOME STUFF
try
{
command.ExecuteNonQuery();
foreach (IDataParameter parameter in command.Parameters)
{
if( parameter.Direction.Equals(
ParameterDirection.InputOutput ) || parameter.Direction.Equals(
ParameterDirection.Output ) )
returnParameters.Add(parameter);
}
}
catch (Exception ex)
{
// ERROR HANDLING HERE
}
}
scope.Complete();
}

Like I said, it happens randomly, but when it does occur, it's on one
of those two methods Open or Execute. Does anyone have any idea why
this breaks down

Thanks in advance for your help!

Sean
 
B

bob

Hi,
They don't come much worse than this do they?
As a test I suggest that you instantiate a new connection inside the method
rather than calling out for it.

FWIW
Bob
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top