none
ActiveX control keeping iexplore.exe process alive after IE is closed RRS feed

  • Question

  • I am developing an ActiveX control for Internet Explorer. The ActiveX control creates COM objects that are invoked from Javascript. 

    I am finding that, occasionally, when all IE windows are closed the IE process ("iexplore.exe" and "iexplore.exe *32" pair) is left running on the system, and can only be terminated through Task Manager. There are also times when the process terminates correctly, it depends on the user's interaction with the control.

    What sort of things can cause these "zombie" processes? How can I determine the cause of the problem using Visual Studio or other tools?

    thanks,
    Leigh

    Wednesday, April 1, 2015 2:39 PM

Answers

  • Then your tab process is not exiting for some reason... and then the frame process can't go away.

    Run ProcessExplorer and see if your dll is still loaded. If so, try write another BHO, have it to call your ActiveX's  DllCanUnloadNow and debug into DllCanUnloadNow to see if you have reference leaking (if so, then you probably want to review your COM code and javascripts). If DllCanUnloadNow returns S_OK, call CoFreeUnusedLibraries and check if you can get the dll unloaded faster. Maybe it is just the default delay holding it up.



    Visual C++ MVP



    Thursday, April 2, 2015 3:26 PM

All replies

  • If you returned S_OK to DllCanUnloadNow then your job is done.

    IE may keep some broker processes (e.g. the crash recovery process) open for some time. If all tab processes are gone then you should not worry about the cleanup of your ActiveX.



    Visual C++ MVP

    Wednesday, April 1, 2015 6:34 PM
  • My DllCanUnloadNow looks like this:

    STDAPI MyDllCanUnloadNow()
    {	
       AFX_MANAGE_STATE(AfxGetStaticModuleState());	
       if (_AtlModule.GetLockCount() > 0)		
          return S_FALSE;	
       return S_OK;
    }

    In debugging I've noticed that GetLockCount() often returns non-zero, and so S_FALSE is returned. However, I have tried modifying this function to always return S_OK and even then the non-terminating process problem can still occur.

    Is the fact that GetLockCount() returns non-zero the root of my problem? Can this keep the process alive?

    Thursday, April 2, 2015 1:52 PM
  • Well this isn't your problem from what you are describing. I am not sure it is a problem at all, since the tab recovery process is supposed to outlive all tab processes. 


    Visual C++ MVP

    Thursday, April 2, 2015 2:04 PM
  • Thanks for your help.

    When the problem occurs, I get an extra "iexplore.exe / iexplore.exe*32" pair for every 'run' of IE. I completely close IE between each run. These processes continue to run until killed via Task Manager. I have seen up to 10 pairs of processes in testing.

     
    Thursday, April 2, 2015 2:09 PM
  • well as long as those are not your processes (you can get process id from your ActiveX) there is nothing you should worry about.

    Probably something else is holding up IE processes.  



    Visual C++ MVP

    Thursday, April 2, 2015 3:00 PM
  • They are my processes. If I log the value of GetCurrentProcessId() in my ActiveX, it corresponds to the PIDs of the "iexplore.exe *32" processes that are persisting on the system.
    Thursday, April 2, 2015 3:16 PM
  • Then your tab process is not exiting for some reason... and then the frame process can't go away.

    Run ProcessExplorer and see if your dll is still loaded. If so, try write another BHO, have it to call your ActiveX's  DllCanUnloadNow and debug into DllCanUnloadNow to see if you have reference leaking (if so, then you probably want to review your COM code and javascripts). If DllCanUnloadNow returns S_OK, call CoFreeUnusedLibraries and check if you can get the dll unloaded faster. Maybe it is just the default delay holding it up.



    Visual C++ MVP



    Thursday, April 2, 2015 3:26 PM