FIX: WriterLock In OLE DB Core Components Can Starve Readers When WriterLock Opens Connections

This article was previously published under Q267566
This article has been archived. It is offered "as is" and will no longer be updated.
Under stress, a bug in the OLE DB Service Components may cause a thread to go into an extremely tight loop, which can cause 100% CPU utilization and thread starvation.

Applications such as Microsoft Internet Information Server (IIS), Microsoft Transaction Server (MTS) and COM+ applications may appear to have stopped responding (hang), when in fact the remaining threads in the process are getting very little context and are unable to complete their operations.
Stressing the OLE DB Service Components with a high number of connection requests can cause contention on the hash tables that contain connection information. When this contention occurs, a thread in the process can enter a for loop that will not exit until the release of an item that is held by other threads in the process. Because this for loop does not contain much code, it runs in an extremely tight loop that causes 100% CPU utilization and starves the other threads for context, so the release never occurs. The for loop does not occasionally yield execution as it should.

This for loop exists in the WriterLock code that protects access to the hash tables. If the threads in the process are examined while the program seems to have stopped responding, one thread is running in the WriterLock code, and numerous other threads are in the ReaderLock code, waiting for a critical section owned by the WriterLock thread.
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 theMicrosoft Knowledge Base:
293312 INFO: How to Obtain the Latest MDAC 2.5 Service Pack
The English version of this fix should have the following file attributes or later:
   Date      Version         Size             File name       ------------------------------------------------------   5/3/00    2.510.5303.0    483,600 bytes    Oledb32.dll				
NOTE: The installer package for this hotfix (Q267566_W2K_SP1_x86_en.EXE) is designed to run on Microsoft Windows 2000 platforms, and will not run on Microsoft Windows NT 4.0, Microsoft Windows 95 or Microsoft Windows 98 platforms. For this reason, the standalone hotfix file is provided as well so that you can copy it directly to Windows NT 4.0, Windows 95 or Windows 98 platforms. The installer package contains the exact same file, which has the attributes indicated in this section.


To work around this problem, disable session pooling by using any of the following methods:
  • Set the OLEDB_SERVICES value for the provider to 0xfffffffc in the registry.

  • Add "OLE DB Services = -2" to the connection strings that the application uses.

  • If you use pure OLE DB code, add code similar to the following to the initialization properties:

    //	OLE DB Services	InitProperties[0].dwPropertyID = DBPROP_INIT_OLEDBSERVICES;	InitProperties[0].vValue.vt = VT_I4;	InitProperties[0].vValue.lVal = DBPROPVAL_OS_ENABLEALL & ~ DBPROPVAL_OS_RESOURCEPOOLING;						
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.5 Service Pack 2.
oledb32.dll writerlock readerlock hung hang 100 cpu utilization connection

Article ID: 267566 - Last Review: 01/06/2015 05:44:17 - Revision: 1.2

Microsoft OLE DB 2.5, Microsoft Data Access Components 2.5

  • kbnosurvey kbarchive kbhotfixserver kbqfe kbbug kbcodesnippet kbfix kbmdac250sp1fix kbmdac250sp2fix kbqfe KB267566