Microsoft KB Archive/313888

= A deadlock issue in the SQL Server network library occurs after a call to the ExitProcess function =

Article ID: 313888

Article Last Modified on 3/9/2006

-

APPLIES TO


 * Microsoft Data Access Components 2.6
 * Microsoft Data Access Components 2.6 Service Pack 1
 * Microsoft Data Access Components 2.6 Service Pack 2
 * Microsoft ADO.NET 2.0
 * Microsoft Data Access Components 2.7
 * Microsoft ADO.NET 1.0
 * Microsoft ADO.NET 1.1
 * Microsoft ASP.NET 1.1
 * Microsoft ASP.NET 1.0

-



This article was previously published under Q313888



SYMPTOMS
When you use ASP.Net to retrieve data from Microsoft SQL Server, the Web server may acquire an accumulation of aspnet_wp processes that are not using the CPU and that have only a few remaining threads.

During ASP.NET process recycling, an aspnet_wp worker process may deadlock with the Dbnetlib.dll file on shutdown after a call to the ExitProcess function. If such a deadlock occurs, the aspnet_isapi cannot kill the old aspnet_wp process, and therefore the process continues to consume memory resources. Repeated occurrences result in performance degradation.



CAUSE
If you connect to a SQL Server database from ASP.NET, it is possible for Dbnetlib.dll to cause a deadlock during process recycling. In a debugger, there will be only a few remaining threads, one of which will contain the following calls in its stack trace:   ... WS2_32!WSACleanup+0x40 dbnetlib!LibMain+0x21f ...



RESOLUTION
To work around this issue, take any action that lessens the frequency of process recycling. It may help if you disable proactive process recycling in the processModel configuration section. To do this, set the following parameters as follows:

requestLimit=&quot;Infinite&quot;

idleTimeout=&quot;Infinite&quot;

timeout=&quot;Infinite&quot;

To reduce process recycling, confirm that your application is free of memory leaks, access violations, and so forth.



STATUS
If a fix for this problem is required, please contact Microsoft technical support.



MORE INFORMATION
During process termination, the LoaderLock is taken by the Ntdll.dll file so that it can begin unloading DLLs. When Dbnetlib.dll is being unloaded, it calls WS2_32!WSACleanup from its DLLMain routine, which, in turn, attempts to unload additional DLLs. This process deadlocks, because the thread already owns the LoaderLock and can execute in only one DLLMain routine at a time.

Additional query words: process shutdown exitprocess hang deadlock dbnetlib dllmain wsacleanup loaderlock aspnet_wp aspnet_isapi

Keywords: kbtshoot kbprb KB313888

-

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

© Microsoft Corporation. All rights reserved.