We are excited to announce that the IIS.NET Forums are moving to the new Microsoft Q&A experience. Learn more >

Need help with handle leak due to COM object [Answered]RSS

1 reply

Last post Oct 01, 2008 03:27 PM by anilr

  • Need help with handle leak due to COM object

    Oct 01, 2008 11:37 AM|jjouett|LINK

    I have two applications where one polls an ASP page on another periodically to retrieve status.  What I have found is that if the poller has a short polling frequency, there is a leak in handles by dllhost.exe, which eventually locks up the pollee system. The pollee system is a classic ASP page, and I've narrowed down the source of the leak to be the retrieval of a COM object from the Application object.  The COM object is set in the Application object in the Application_onStart() method as follows:

    Sub Application_onStart()
      On Error Resume Next
      Set Application("objDevices") = Server.CreateObject("Package.Class")
    End Sub

    And within the pollee ASP page in question, if I strip it down to the following:

    Set objDevices = Application("objDevices")
    Response.ContentType="text/xml"
    Response.Write("<OK/>")
    Response.End()

    I still get a handle leak from dllhost.exe if I poll this page once every second.  I've found that if I increase the polling interval to 5 seconds that there doesn't seem to be a handle leak, but I would really like to understand what is causing the leak and if there is any way to fix it other than increasing the polling interval, since I'm paranoid that eventually 5 seconds may be too short. Since the object has already been created in the Application_onStart() and no methods on the object are being invoked, I wouldn't think that there would be anything related to the code in the object itself causing the leak. Using Process Explorer on the pollee system, the dllhost.exe instance in question showed that the leaked handles were named HOSTNAME\IUSR_MACHINENAME, where HOSTNAME is the host name of the pollee system.

    Any suggestions or insight into why this COM object retrieval would be resulting in a handle leak based on the polling frequency would really be appreciated.  If there is something to change on the ASP side to prevent this, please let me know.

    Thanks in advance

  • Re: Need help with handle leak due to COM object

    Oct 01, 2008 03:27 PM|anilr|LINK

    I assume the dllhost.exe in question is the one your COM object is running in?  There would be no IIS code running in that dllhost - the cause of the token handle leak would be in the COM object code.  The asp code below will at least call AddRef/Release on your COM object.

    Anil Ruia
    Software Design Engineer
    IIS Core Server