Attempted to read or write protected memory

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
DaGoat
Posts: 5
Joined: Wed 26 Nov 2008 21:03

Attempted to read or write protected memory

Post by DaGoat » Thu 15 Jan 2009 19:22

Ok, I get this error sometimes and it is becoming a problem with my customers. I hope there is a fix for this or some kind of solution. In other words, Please Help !!

This seems to happen on a simple Statement - "Select FIELDS from TABLE Where ID = 1234". Like I said, it happens maybe 1 in a 1000 calls to the databse.

Error Follows:
-------------------------------
Exception Message: Devart.Data.Oracle.OracleException: Internal exception in Oracle client occurred. ---> System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
at OciDynamicType.nativea(HandleRef , HandleRef , HandleRef , Int32 ,
Int32 , Int32 , Int32 , Int32 )
at OciDynamicType.a(HandleRef , HandleRef , HandleRef , Int32 , Int32 ,
Int32 , Int32 , Int32 )
at Devart.Data.Oracle.an.a(Int32 A_0, a2 A_1)
--- End of inner exception stack trace ---
at Devart.Data.Oracle.an.a(Int32 A_0, a2 A_1)
at Devart.Data.Oracle.OracleCommand.a(CommandBehavior A_0, IDisposable A_1, Int32 A_2, Int32 A_3)
at Devart.Common.DbCommandBase.ExecuteDbDataReader(CommandBehavior
behavior)
at
System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBeha
vior behavior)
at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior)
at Devart.Data.Oracle.OracleDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)
----------------------------

HELP!!!

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Fri 16 Jan 2009 14:01

Please try to define the problem more exactly.
Does this problem persist if this query is executed in a separate application (maybe it is caused by another issue)?
What is the type of the column, which value you are getting by the select statement? Does the error occur with the different types?
We need more information on this issue.
Tell us the version of dotConnect for Oracle (you can see it in Tools | Oracle | About menu of Visual Studio) and the version of your Oracle server and client you are using.

DaGoat
Posts: 5
Joined: Wed 26 Nov 2008 21:03

Post by DaGoat » Sun 18 Jan 2009 05:36

I take it, that this is something not seen before. Ok, let me try to give you as much info as possible.

OraConnect Version: 5.0.12.0
Visual Studio Version: 2008
Oracle Version: 9i .2 (some patch number)

Select Statement, and I stress that it seems to happen here the most, as other areas it happens as well.

Statement: Select CODEID from FILESTORAGE Where ID = 1312
CODEID field is Defined as VarChar(10) , ID field is numeric.

This error is impossible to reproduce at will, and it seems to happen once a day. I have check my code over and over again trying to figure this out. I know you are probably going to do the same and say that it is impossible to tell what causes this. I think it has something to do with Oracle itself or some other source. But I appreciate any help I can get. I have checked around with other forums and data connectors and this is an error that no one has been able to put a finger on. It seems to affect other Oracle Data Connection Venders including a regular .NET ODBC driver for Oracle. Below is the simple code that is executed when this takes place.

Try
Dim dt As New DataTable

Using cn As New Devart.Data.Oracle.OracleConnection(ConnectionString)
cn.Open()

Using cm As New Devart.Data.Oracle.OracleCommand(sqlStatement, cn)
Using da As New Devart.Data.Oracle.OracleDataAdapter(cm)
da.Fill(dt)
End Using
End Using

End Using

Return dt
Catch ex As Exception
Throw
End Try


Now, I do have the application in layers, Business and Data Access DLLs, and a UI layer (EXE). Business Layer calls data access witch runs the above code.

Thank you for taking the time.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Mon 19 Jan 2009 11:58

The reason of this kind of error could be in a place quite different from the one where AccessViolationException occurs. The method of such error detection is in consecutive disabling definite fragments of code, and in checking the application behaviour.
Did you have such problems with VarChar, NUMBER fields? You should pay attention to the following types: LONG, LONG RAW, OBJECT, XMLTYPE. Maybe there is a code that works with these types, try disabling it. Also try using the Direct=true mode for test purposeses. In this mode the unmanaged code is not used. As a result, probably, the error will be different. Maybe your application uses the unmanaged code or calls from an unmanaged *.dll. Check your code.
Try executing the code you have posted in a separate application. Most likely it will be without this error.

Alladin
Posts: 149
Joined: Mon 27 Nov 2006 16:18
Contact:

Post by Alladin » Mon 19 Jan 2009 15:45

Please make sure, that OracleConnection.Unicode set to true :)

I've got cured the same illness like this...

Post Reply