Debugging Custom Actions: Leaked Handles

Debugging Custom Actions: Leaked Handles

  • Comments 3

Debugging custom actions isn't exactly the easiest action to do; Windows Installer spawns separate processes - remoting servers - to run in-process custom actions. Any opportunity to diagnose issues without debugging can be helpful.

For example, an issue that comes up from time to time is leaked handles. A Windows Installer debug log might show something similar to the following:

MSI (s) (CC:1C) [17:40:29:055]: Doing action: MyCustomAction
MSI (s) (CC:58) [17:40:29:165]: Invoking remote custom action. DLL: C:\WINDOWS\Installer\MSI1B.tmp, Entrypoint: MyCustomAction
Action start 17:40:29: MyCustomAction.
MSI (s) (CC:58) [17:40:29:906]: Leaked MSIHANDLE (219) of type 790531 for thread 3676
MSI (s) (CC:58) [17:40:29:906]: Leaked MSIHANDLE (190) of type 790540 for thread 3676
MSI (s) (CC:58) [17:40:29:906]: Leaked MSIHANDLE (189) of type 790540 for thread 3676
MSI (s) (CC:58) [17:40:29:906]: Leaked MSIHANDLE (188) of type 790540 for thread 3676
MSI (s) (CC:58) [17:40:29:906]: Leaked MSIHANDLE (179) of type 790541 for thread 3676
MSI (s) (CC:58) [17:40:29:906]: Note: 1: 2769 2: MyCustomAction 3: 5
DEBUG: Error 2769: Custom Action MyCustomAction did not close 5
Action ended 17:40:30: MyCustomAction. Return value 3.

Windows Installer provides a clue in the log that can help with a code review. The Windows Installer team has provided the following information:

  • MSIHANDLE type 790531 identifies a record
  • MSIHANDLE type 790540 identifies a view
  • MSIHANDLE type 790541 identifies a database

With this knowledge, you should be able to review your code and spot cause of the issue.

Leave a Comment
  • Please add 6 and 2 and type the answer here:
  • Post
Page 1 of 1 (3 items)