By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,771 Members | 1,685 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,771 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: 1
dom
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

P: 1
naz
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.