469,631 Members | 1,476 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,631 developers. It's quick & easy.

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

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.OraMTSJoinT xn(OciEnlistContext
pCtxt, IDtcTransaction pTrans)
at
System.Data.OracleClient.TracedNativeMethods.OraMT SJoinTxn(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.Acti vateConnection(Transaction
transaction)
at
System.Data.ProviderBase.DbConnectionPool.GetConne ction(DbConnection
owningObject)
at
System.Data.ProviderBase.DbConnectionFactory.GetCo nnection(DbConnection
owningConnection)
at
System.Data.ProviderBase.DbConnectionClosed.OpenCo nnection(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

Feb 21 '06 #1
3 6914
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
<OU*********@gmail.com> wrote in message
news:11*********************@g14g2000cwa.googlegro ups.com...
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.OraMTSJoinT xn(OciEnlistContext
pCtxt, IDtcTransaction pTrans)
at
System.Data.OracleClient.TracedNativeMethods.OraMT SJoinTxn(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.Acti vateConnection(Transaction transaction)
at
System.Data.ProviderBase.DbConnectionPool.GetConne ction(DbConnection
owningObject)
at
System.Data.ProviderBase.DbConnectionFactory.GetCo nnection(DbConnection
owningConnection)
at
System.Data.ProviderBase.DbConnectionClosed.OpenCo nnection(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

Feb 21 '06 #2
dom
1
Have a look to the service called 'Distributed Transaction Coordinator'. It must be set to Automatic Start. Otherwise the error occurs.
May 2 '06 #3
naz
1
That worked and was very helpful, thanks. . .

Have a look to the service called 'Distributed Transaction Coordinator'. It must be set to Automatic Start. Otherwise the error occurs.
Jul 10 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by =?Utf-8?B?UGFydGhpYmFu?= | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.