Welcome to MSDN Blogs Sign in | Join | Help

Debugging Custom Actions: Leaked Handles

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.

Published Tuesday, February 12, 2008 12:19 PM by Heath Stewart

Comments

Tuesday, February 12, 2008 3:55 PM by MSDN Blog Postings » 2008 » February » 12

# MSDN Blog Postings » 2008 » February » 12

Wednesday, February 13, 2008 1:24 AM by とっちゃん's Blog

# [msi] カスタムアクションのデバッグ:MSIHANDLEのリークの検出

[msi] カスタムアクションのデバッグ:MSIHANDLEのリークの検出

Friday, February 15, 2008 12:50 AM by Christopher Painter

# re: Debugging Custom Actions: Leaked Handles

Silly question time.... are those values for the types actually documented anywhere other then this blog?   I don't recall ever reading it in the SDK, in any header files and any other web pages.

I'm glad you shared this tidbit, but it just goes to show how you have to work inside the firewall to get access to useful information.

New Comments to this post are disabled
 
Page view tracker