Microsoft KB Archive/272373

= FIX: Access Violation Occurs When Closing ADO Recordset in Multithreaded Application =

Article ID: 272373

Article Last Modified on 4/7/2006

-

APPLIES TO


 * Microsoft Data Access Components 2.5
 * Microsoft Data Access Components 2.5 Service Pack 1
 * Microsoft Data Access Components 2.6

-



This article was previously published under Q272373



SYMPTOMS
When running multithreaded ActiveX Data Objects (ADO) code under high stress on a multiprocessor computer, an access violation (AV) may occur when closing an ADO Recordset. Examination of the call stack at the time of the AV (with the appropriate debugging symbols installed) reveals that the last ADO call on the stack is a call to the ADO internal function msado15!CCollectionArray__Delete.



RESOLUTION
This problem is fixed in the latest service packs for Microsoft Windows 2000, MDAC 2.5, and MDAC 2.6, and in MDAC version 2.7.  To resolve this problem, obtain the latest service pack for Windows 2000. For additional information, click the following article number to view the article in the Microsoft Knowledge Base:

260910 How to Obtain the Latest Windows 2000 Service Pack

 To resolve this problem, obtain the latest service pack for Microsoft Data Access Components 2.5. For additional information, click the following article number to view the article in the Microsoft Knowledge Base:

293312 INFO: How to Obtain the Latest MDAC 2.5 Service Pack

 To resolve this problem, obtain the latest service pack for Microsoft Data Access Components 2.6. For additional information, click the following article number to view the article in the Microsoft Knowledge Base:

300635 INFO: How to Obtain the Latest MDAC 2.6 Service Pack



Hotfix
The English version of this fix have the following file attributes or later:

  Date         Version       Size      File name     Platform ---  09/15/2000   2.51.5715.0   487,696   Msado15.dll   x86



WORKAROUND
Avoid closing an ADO Recordset and its parent ADO Connection object at exactly the same time on 2 different threads, or apply this hotfix.



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 (MDAC) 2.5 Service Pack 2, MDAC 2.6 Service Pack 1, MDAC 2.7, and Microsoft Windows 2000 Service Pack 2.



MORE INFORMATION
To reproduce the problem, an ADO Recordset and its parent ADO Connection must be closed or released on 2 different threads at exactly the same time. Note that this issue has only been successfully reproduced on a multiprocessor machine.

The initial problem was discovered by using the Windows Foundation Classes (WFC) ADO Java classes in a COM+ application under heavy stress with ADO set to free-threaded mode. The Microsoft virtual machine (Microsoft VM) defers the release of COM objects until the garbage collector is activated. Also, the garbage collector performs the release of the COM object on a background thread. If you close a WFC ADO Connection, this places the ADO Connection COM interface pointer into a list of pointers for future cleanup by the garbage collector. If the main application code subsequently closes an ADO Recordset at exactly the same time that the garbage collector background thread releases its parent ADO Connection interface pointer, the AV can occur.

Additional query words: multi threaded processor

Keywords: kbbug kbfix kbmdac250sp2fix kbqfe kbmdac260sp1fix kbhotfixserver KB272373

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.