FIX: Race Condition on Heap Variable Causes Access Violation in Oracle ODBC Driver

This article was previously published under Q290907
This article has been archived. It is offered "as is" and will no longer be updated.
SYMPTOMS
When the Microsoft ODBC driver for Oracle is being loaded for the first time and is still in the initialization routines, two threads attempting to use the driver at the same time can encounter a race condition that causes an access violation (AV) in the ODBC driver.

This problem can occur in the Microsoft Data Access Components (MDAC) 2.6 version of the Oracle ODBC driver (2.573.6526.0) and earlier.
CAUSE
During initialization, the Microsoft Oracle ODBC driver creates a heap for its own internal use. This heap is created during the driver's DLLMain() initialization routines, and a handle to the heap is saved in a global variable.

Just prior to the creation of the heap, the driver loads the Oracle network libraries, which are necessary for communicating with the Oracle server. These DLLs can occasionally take a considerable amount of time to load, which delays the initialization of the heap variable.

If an additional thread is also starting up at the same time, it may attempt to use the heap handle before the other thread has given it a valid address, and an AV will occur.
RESOLUTION
This bug has been fixed in the Oracle ODBC Driver included with MDAC version 2.6 SP1.
STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article. This problem was first corrected in Microsoft Data Access Components 2.6 Service Pack 1.
MORE INFORMATION
This fix can be applied to MDAC 2.5 and MDAC 2.6.
oracle odbc driver heap av crash dllmain initialization threads race
Properties

Article ID: 290907 - Last Review: 01/17/2015 16:24:06 - Revision: 2.1

  • Microsoft Open Database Connectivity 2.5
  • Microsoft Open Database Connectivity 2.5
  • Microsoft Open Database Connectivity 2.5
  • Microsoft Open Database Connectivity 2.0
  • Microsoft Open Database Connectivity 2.5
  • Microsoft Open Database Connectivity 2.5
  • Microsoft Open Database Connectivity 2.5
  • Microsoft Open Database Connectivity 2.5
  • kbnosurvey kbarchive kbhotfixserver kbqfe kbbug kbfix kbmdac260sp1fix kboracle kbqfe KB290907
Feedback