Intermittant Access Violation in OleDbDataReader "Attempted to read or write protected memory" (Doc ID 1078331.1)

Last updated on JULY 05, 2017

Applies to:

Oracle Provider for OLE DB - Version: 10.2.0.1 to 11.1.0.7 - Release: 10.2 to 11.1
Information in this document applies to any platform.

Symptoms

An OLEDB  ADO.Net C# application intermittently fails with

System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
at System.Data.Common.UnsafeNativeMethods.IRowset.GetData(IntPtr hRow, IntPtr hAccessor, IntPtr pData)
at System.Data.OleDb.OleDbDataReader.GetRowDataFromHandle()
at System.Data.OleDb.OleDbDataReader.GetValueBinding(MetaData info)
...

Obtaining the Call stack from an adplus crash dump shows

  Error In MINIDUMP_FirstChance_av_AccessViolation_xxx__08ac_2010-03-24_18-22-11-142_0650.dmp
 the assembly instruction at
oledb32!mbsnlen+49 in C:\Program Files\Common Files\System\Ole DB\oledb32.dll
from Microsoft Corporation has caused an access violation exception (0xC0000005) when trying to read from memory location 0x0a6b1000 on thread 0
 
oledb32!mbsnlen+49
oledb32!CDataConvert::DataConvert+394c
OraOLEDB11+131bf
mscorwks!WKS::gc_heap::allocate_more_space+11
mscorwks!HelperMethodFrame::LazyInit+17
mscorwks!HelperMethodFrame::HelperMethodFrame+1d
mscorwks!HelperMethodFrame_1OBJ::HelperMethodFrame_1OBJ+14
mscorwks!FrameWithCookie::FrameWithCookie+21
mscorwks!SafeHandle::AddRef+18
System_Data_ni!_bidW103+3ccecb
The problem is reproducible just using OledbDataReader in a simple loop. Although it may need several iterations to cause the error to occur.

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms