ArcMap.exe processes stay open after closing ArcMap?

Not your fault and not much you can do about it. However, if you are curious about the reason, what happens is that there is a COM circular reference (most likely to something listening to some event source - like the Editor) and when the applications attempts to exit it cannot, because some objects are keeping each other alive. This can be from an extension that you have installed, or even from within ESRI code itself. This used to happen all the time and it may only manifest itself under certain conditions, like certain commands being visible in the toolbar.

From an old ArcObjects tutorial on COM concepts:

When the application exits, it releases the reference it holds to the command. If the command also serves as an event sink, the application holds another reference to the command, which cannot be released until the command disconnects from the source. As the command does not know of a point at which it can disconnect other than its own destructor, this causes a circular reference whereby the application cannot exit without the command destroying and the command's destructor never gets called because the application holds a reference to the command. This causes the application to hang on exit.

If you are even more curious, delete (or backup) your Normal.mxt, which will wipe out all customizations and see if this problem persists.


Thank You @Kirk and @Ragi for solving this problem! Here is what I have done while monitoring the Task Manager Processes:

  1. Backed up and deleted Normal.mxt
  2. Started new ArcMap Document (ArcMap opened in default configuration)
  3. Closed ArcMap (Process closed as expected)
  4. Added Toobars: 3D Analyst, Advanced Editing, Data Frame Tools, Draw, Edit Vertices, Editor, Georeferenceing, Labeling, Layout, Snapping
  5. Arranged toolbars
  6. Closed ArcMap (Process closed as expected)
  7. Started new ArcMap Document
  8. Added my own custom toolbar with add-ins
  9. Closed ArcMap (Process closed as expected)
  10. Started an existing ArcMap Document
  11. Used custom start and stop editing on my toolbar as well as several custom tools
  12. Closed ArcMap (Process closed as expected)

I also removed and deleted ArcBruTile

ArcMap Processes now close as expected


Not trying to bring this post back from the dead, but while working with ESRI support on this issue with a Citrix server (users crash or log out, arcgiscachemanager.exe doesn't close out 20-30 minutes later or more if at all, users cannot get back in to ArcMap and then they have to rely on on of 2 server administrators to be available to log into the server and manually release them), ESRI is copying and pasting a solution from this page and it doesn't work. At least not when working in a Citrix environment.

For Citrix, we found that creating two registry keys (one for killing the hung process, one for pushing settings back to their original state) "fixed" the issue.

For non-Citrix, we've toyed with the idea of just creating a script to kill the process, but since when we are not in Citrix, we are already on the server, we decided it wasn't necessary.

Hope this helps.

-------copied data from escalated support ticket-------- Citrix has registry key settings that will help manage applications that spawn secondary processes in the background. You have a lot of the symptoms that should make this solution a plausible setup. Have a look through the following Citrix Knowledge Articles:

Graceful Logoff from a Published Application Renders the Session in Active State: http://support.citrix.com/article/CTX891671

Active Sessions after User Logs Off in a XenApp Environment when Upgraded from Windows Server 2003 to Windows Server 2008: http://support.citrix.com/article/CTX134956

XenApp 6.5 AppCenter Console Displays Application Status Application Not Running: http://support.citrix.com/article/CTX133328

In these articles, it discusses how published applications can cause a session not to close or a user not being properly logged off. In those cases, sessions had to be reset/exited by an admin or by terminating the process from the server that was still running. What happens in Citrix is that you publish the main application, in your case ArcMap. Only that exe is closed when exiting an application (or if it crashes). As a result, any exe's associated with the application that were spawned when the application was opened are not be fully closed out in Citrix resulting in this state. So when the ArcGISCacheMgr.exe takes a long time to execute or the application crashes your end users are left unable to start a new session.

The articles discuss how you can add these secondary processes to a registry key to close them automatically on close of the main application. Another option you can explore is a logoff script to check for the processes and terminate them if they exist.