Need help with handle leak due to COM object RRS feed

  • Question

  • User-797525717 posted

    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")

    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

    Wednesday, October 1, 2008 11:37 AM


  • User511787461 posted

    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.

    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Wednesday, October 1, 2008 3:27 PM