Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

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


View products that this article applies to.

This article was previously published under Q313888

↑ Back to the top


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.

↑ Back to the top


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
   ...
				

↑ Back to the top


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="Infinite"
idleTimeout="Infinite"
timeout="Infinite"
To reduce process recycling, confirm that your application is free of memory leaks, access violations, and so forth.

↑ Back to the top


Status

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

↑ Back to the top


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.

↑ Back to the top


Keywords: kbtshoot, kbprb, KB313888

↑ Back to the top

Article Info
Article ID : 313888
Revision : 10
Created on : 3/9/2006
Published on : 3/9/2006
Exists online : False
Views : 447