Friday, July 29, 2005

Leak by Apache aspdotnet module


It turns out to be Apache aspdotnet mod bug

This is a bug reported from Apache site:
We are doing production testing with our application, Oracle ODP.NET, and
mod_aspdotnet and noticed memory leaks occuring within the Apache process with
mod_aspdotnet installed. Our application does not leak with IIS or the Casini
web server. The objects which are not GC'd are those requiring finalization. I
examined the running process with WinDBG and SOS and found that the finalizer
thread in the application domain was stalled waiting on on a event sync for
one of the application STA model threads. I have made a test change in
mod_aspdotnet.cpp which converts the application threads from STA to MTA and
the problem seems to go away. Here is the code change (2 places):
Old:
// Check that THIS thread is coinitialized.
HRESULT hr = CoInitialize(NULL);
if (hr == RPC_E_CHANGED_MODE)
hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);


New:
// Check that THIS thread is coinitialized.
HRESULT hr = CoInitializeEx(NULL,COINIT_MULTITHREADED);
// if (hr == RPC_E_CHANGED_MODE)
// hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);

After making this changed, I verified that all threads are MTA and that the
finalizer is not stalled. I have run several high throughput tests with our
application hitting both the 2.0 mod_aspdotnet and my modified module and the
modified module does not leak managed objects over 24 hour periods.

0 Comments:

Post a Comment

<< Home