AcccessViolation Exception

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
sgawde
Posts: 14
Joined: Fri 20 Jul 2012 02:37

AcccessViolation Exception

Post by sgawde » Fri 20 Jul 2012 04:04

Hi,

We are using dotConnect For Oracle version 6.80.325, to access Oracle 11g from ASP.net (4.0) Web applicatiion.
We observed following error occurring intermittently (mostly during heavy application load). This results in crashing Worker Process.

Error: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. at OciDynamicType.nativeOCIAttrGet(HandleRef , UInt32 , IntPtr& , IntPtr& , UInt32 , HandleRef )
at OciDynamicType.OCIAttrGet(HandleRef , UInt32 , IntPtr& , IntPtr& , UInt32 , HandleRef )
at Devart.Data.Oracle.a7.f()
at Devart.Data.Oracle.OracleDataReader.b()
at Devart.Data.Oracle.OracleDataReader..ctor(ak A_0, ak[] A_1, OracleConnection A_2, CommandBehavior A_3, Int32 A_4, Int32 A_5, OracleNumberMappingCollection A_6, Boolean A_7)
at Devart.Data.Oracle.OracleCommand.InternalExecute(CommandBehavior behavior, IDisposable disposable, Int32 startRecord, Int32 maxRecords, Boolean nonQuery)
at Devart.Common.DbCommandBase.ExecuteDbDataReader(CommandBehavior behavior, Boolean nonQuery)
at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior 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(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable)


Few more stacktrace where this error is seen are.
1.
at OciDynamicType.nativeOCIDescriptorFree(IntPtr , Int32 )
at OciDynamicType.OCIDescriptorFree(IntPtr , Int32 )
at Devart.Data.Oracle.a.a(IntPtr A_0)
at Devart.Data.Oracle.a7.l()
at Devart.Data.Oracle.a7.a()
at Devart.Data.Oracle.OracleDataReader.Close()
at Devart.Common.DbCommandBase.ExecuteScalar()

2.
at OciDynamicType.nativeOCIDescriptorFree(IntPtr , Int32 )
at OciDynamicType.OCIDescriptorFree(IntPtr , Int32 )
at Devart.Data.Oracle.a.a(IntPtr A_0)
at Devart.Data.Oracle.a7.l()
at Devart.Data.Oracle.a7.a()
at Devart.Data.Oracle.OracleDataReader.Close()
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(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet)

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

Re: AcccessViolation Exception

Post by Shalex » Wed 25 Jul 2012 10:32

1. Please specify the exact (x.xx.xxx) versions of the Oracle server and client you are using. A possible reason of these issues is a problem in the Oracle client software or client/server compatibility. To check if this is the case, you can try switching to the Direct mode or changing the version of the client. Tell us if these problems occur again in either case.
2. Try to localize the problem by implementing logging. Save the data which are sent to the server to find a particular query which results in AccessViolationException. Does it allow to reproduce the problem permanently? If yes, please create and send us a small test project with the corresponding DDL/DML script.

sgawde
Posts: 14
Joined: Fri 20 Jul 2012 02:37

Re: AcccessViolation Exception

Post by sgawde » Wed 25 Jul 2012 14:39

1. Oracle Client version : 11.2.01
Oracle Server version : Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production

2. Issue does not occur in specific scenarios or specific query. We observe it during performance test. It some times occurs after 1 hour, some times after 5 hours, 10 hours and so on.
We trying to replicate the error through Sample application, however we are unable to replicate it till now.

Thanks in Advance,
Sandeep

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

Re: AcccessViolation Exception

Post by Shalex » Thu 26 Jul 2012 16:17

1. As a workaround, you can use the Direct mode: http://www.devart.com/dotconnect/oracle ... tmode.html .
2. If possible, try another version of Oracle client - does the problem persist in this case as well?
3. We appreciate an additional information which can be obtained with the help of logging (if possible) to localize the issue and reproduce it in our environment.

dhoenig
Posts: 16
Joined: Tue 20 Jul 2010 20:33

Re: AcccessViolation Exception

Post by dhoenig » Sun 02 Sep 2012 18:37

Have you found a solution to this issue? We are experiencing the same exception. It's very random...we are using dotconnect 6.80.350

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

Re: AcccessViolation Exception

Post by Shalex » Thu 06 Sep 2012 12:26

dhoenig,
Please give us the following information:
1) the exact versions of your Oracle server and client;
2) have you tried using another version of Oracle client (to find out if this is an Oracle client's bug or not)?
3) we need a small test project with the corresponding DDL/DML script to reproduce the problem in our environment. Or try to localize the issue (as more as possible) and give us its details and at least approximate steps we should follow.

As a workaround, try using the Direct Mode.

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

Re: AcccessViolation Exception

Post by Alladin » Fri 14 Sep 2012 14:43

We have the same problem. Version: 6.80.350.0, Latest Oracle Instant Client x64 bit 11.2.0.3.

Clean Windows 8 machine (no full blown oracle client installed), only changes are:

Environment variables:
TNS_ADMIN=c:\oracle (here is the TNSNAMES.ORA & SQLNET.ORA)
NLS_LANG=AMERICAN_AMERICA.AL32UTF8
PATH=c:\Oracle\x64;... (there is the x64 bit oracle instant client dlls)

Code: Select all

select id from testtable
works great, id is varchar2(22)

Code: Select all

select ts from testtable
crashes with call stack below, ts is timestamp column


Call stack is:

at OciDynamicType.nativeOCIDescriptorFree(IntPtr , Int32 )
at OciDynamicType.OCIDescriptorFree(IntPtr , Int32 )
at Devart.Data.Oracle.cb.a(IntPtr A_0)
at Devart.Data.Oracle.a9.l()
at Devart.Data.Oracle.a9.a()
at Devart.Data.Oracle.ak.s()
at Devart.Data.Oracle.OracleDataReader.Close()
at Devart.Data.Oracle.OracleDataReader.System.IDisposable.Dispose()
at DevArt.x64.Program.Main(String[] args)

Any help would be really appreciated. We do not welcome direct mode, because of additional configuration troubles.

In x32 mode everything works great. However x32 mode is obsolete for all our code.

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

Re: AcccessViolation Exception

Post by Shalex » Wed 19 Sep 2012 11:36

Alladin, we still cannot reproduce the issue.
1. Does the problem occur in your environment permanently or intermittently?
2. Specify the version of your Oracle server.
3. Post here a code snippet you are using to retrieve data.
4. If possible, try the latest (7.2.77) version of dotConnect for Oracle. Does the issue persist with this version as well? If you do not have access to the registered version, you can check the trial: http://www.devart.com/dotconnect/oracle/dcoracle.exe.
Notify us about the results.

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

Re: AcccessViolation Exception

Post by Alladin » Mon 24 Sep 2012 09:42

1. Does the problem occur in your environment permanently or intermittently?
It always happens. IIS 8/Windows 8 Pro/x64 bit/.NET 4.5

2. Specify the version of your Oracle server.
Oracle server 11.2.0.3.0, Windows 8 Server.

3. Post here a code snippet you are using to retrieve data.

Code: Select all

static void Main(string[] args)
    {
      using (var conn = new OracleConnection("User Id=A;Password=B;Server=C;Unicode=true;"))
      {
        conn.Open();

        /// this query works
        using (var cmd = new OracleCommand("select t.id from environments t", conn))
        using (var reader = cmd.ExecuteReader())
          while (!reader.EndOfData)
            reader.Read();

        /// this query fails (ts column is timestamp(6))
        using (var cmd = new OracleCommand("select t.ts from environments t", conn))
        using (var reader = cmd.ExecuteReader())
          while (!reader.EndOfData)
            reader.Read();

      }
    }


4. If possible, try the latest (7.2.77) version of dotConnect for Oracle.
Fails also with the latest version 7.2.77.

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

Re: AcccessViolation Exception

Post by Alladin » Mon 24 Sep 2012 11:34

Here are the oracle instance parameters:

Code: Select all

PARAMETER                VALUE
NLS_CALENDAR             GREGORIAN
NLS_CHARACTERSET         AL32UTF8
NLS_COMP                 BINARY
NLS_CURRENCY             #
NLS_DATE_FORMAT          DD-MON-RR
NLS_DATE_LANGUAGE        ENGLISH
NLS_DUAL_CURRENCY        ?
NLS_ISO_CURRENCY         UNITED KINGDOM
NLS_LANGUAGE             ENGLISH
NLS_LENGTH_SEMANTICS     BYTE
NLS_NCHAR_CHARACTERSET   UTF8
NLS_NCHAR_CONV_EXCP      FALSE
NLS_NUMERIC_CHARACTERS   .,
NLS_RDBMS_VERSION        11.2.0.3.0
NLS_SORT                 BINARY
NLS_TERRITORY            UNITED KINGDOM
NLS_TIMESTAMP_FORMAT     DD-MON-RR HH24.MI.SSXFF
NLS_TIMESTAMP_TZ_FORMAT  DD-MON-RR HH24.MI.SSXFF TZR
NLS_TIME_FORMAT          HH24.MI.SSXFF
NLS_TIME_TZ_FORMAT       HH24.MI.SSXFF TZR

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

Re: AcccessViolation Exception

Post by Shalex » Wed 26 Sep 2012 17:05

We have reproduced the error and are investigating the issue. We will post here about the results.

dhoenig
Posts: 16
Joined: Tue 20 Jul 2010 20:33

Re: AcccessViolation Exception

Post by dhoenig » Thu 27 Sep 2012 21:59

We have found that the AccessViolationException happens after this error.

“Server did not respond within the specified timeout interval”
"at Devart.Data.Oracle.bf.a(ag A_0, am A_1)
at Devart.Data.Oracle.OracleInternalConnection..ctor(ag connectionOptions, OracleInternalConnection proxyConnection)
at Devart.Data.Oracle.df.a(i A_0, Object A_1, DbConnectionBase A_2)
at Devart.Common.DbConnectionFactory.a(DbConnectionPool A_0, i A_1, DbConnectionBase A_2)
at Devart.Common.DbConnectionPool.a(DbConnectionBase A_0)
at Devart.Common.DbConnectionPool.GetObject(DbConnectionBase owningConnection)
at Devart.Common.DbConnectionFactory.b(DbConnectionBase A_0)
at Devart.Common.DbConnectionClosed.Open(DbConnectionBase outerConnection)
at Devart.Common.DbConnectionBase.Open()
at Devart.Data.Oracle.OracleConnection.Open()
at Dtn.PetroDex.Infrastructure.DataAccess.PetroDexDataAccess.OpenConnection() in


We have upgraded our Devart version to 7.2.77 to see if it fixes the “Server did not respond within the specified timeout interval” error.

dhoenig
Posts: 16
Joined: Tue 20 Jul 2010 20:33

Re: AcccessViolation Exception

Post by dhoenig » Tue 02 Oct 2012 13:29

Upgrading to 7.2.77 did not help with the “Server did not respond within the specified timeout interval” error. But, I don't see AccessViolationException anymore...

I guess I'll try adding the Validate Connection property to the connection string.

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

Re: AcccessViolation Exception

Post by Shalex » Wed 03 Oct 2012 08:58

The bug with generating AccessViolationException when retrieving data via OracleDataReader using the x64 version of Oracle client is fixed. We will post here when the corresponding build of dotConnect for Oracle is available for download.

sgawde
Posts: 14
Joined: Fri 20 Jul 2012 02:37

Re: AcccessViolation Exception

Post by sgawde » Thu 04 Oct 2012 14:33

Shalex,

When can we expect the corresponding DevArt Release?

Thanks,
Sandeep

Post Reply