jstart
Posts: 18
Joined: Fri Apr 17, 2015 10:48 am

Crash seen in MMC if snap-in in use during uninstall

**** UPDATED: attached incorrect AI project file, should be "Test Application 2.aip" ****

One of our server products crashes most of the time during uninstall if our MMC SnapIn is in use during the uninstall after trying to automatically close the application.

I’ve been able to repro the issue using the simple Hello World mmc snap-in (MS sample code) at:
https://msdn.microsoft.com/en-us/librar ... 85%29.aspx
This has been built using VS2010 SP1 as Intel x64, .NET 4.

I’ve created a simple AI (v12.3.1) installation package to install and register the sample snap-in – it uses a .NET Installer Class custom action to register / unregister the snap-in.

Install package on Windows 2012R2 server (no Windows updates) – this has only .NET4 installed, no other versions.
Run “mmc”.
Add the snap-in: File | Add/Remove Snap-in | - Simple SnapIn Sample | Add, then press OK.
Leave the mmc console with the sample snapin running.
Now uninstall the “Test Application” package.
The installer displays a dialog stating “The following application should be closed before continuing the install: Microsoft Management Console”.
Ensure the default choice “Automatically close applications…” is selected.
Press OK.
Now get 2x crash dialogs: “MMC has stopped working” dialog, problem details: APPCRASH, mmc.exe. DUser.dll

The Windows Event log records the following, in order:
1) .NET runtime:
Application: mmc.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: exception code c0000005, exception address 00007FF8FE4A1112
Stack:

2) Application Error:
Faulting application name: mmc.exe, version: 6.3.9600.16384, time stamp: 0x5215ef8f
Faulting module name: DUser.dll, version: 6.3.9600.16384, time stamp: 0x5215daf7
Exception code: 0xc0000005
Fault offset: 0x0000000000001112
Faulting process id: 0x32ec
Faulting application start time: 0x01d18044fcfdd8ee
Faulting application path: C:\Windows\System32\mmc.exe
Faulting module path: C:\Windows\System32\DUser.dll
Report Id: 43acbd87-ec38-11e5-80bf-00155d013578
Faulting package full name:
Faulting package-relative application ID:
3) Application Error:
Faulting application name: mmc.exe, version: 6.3.9600.16384, time stamp: 0x5215ef8f
Faulting module name: DUser.dll, version: 6.3.9600.16384, time stamp: 0x5215daf7
Exception code: 0xc000041d
Fault offset: 0x0000000000001112
Faulting process id: 0x32ec
Faulting application start time: 0x01d18044fcfdd8ee
Faulting application path: C:\Windows\System32\mmc.exe
Faulting module path: C:\Windows\System32\DUser.dll
Report Id: 45693b5b-ec38-11e5-80bf-00155d013578
Faulting package full name:
Faulting package-relative application ID:
Attachments
Test Application 2.aip
AI project file
(14.96 KiB) Downloaded 492 times
Test Application 2_msi.txt
MSI package showing issue.
(378.5 KiB) Downloaded 464 times
MMCsample_dll.txt
MMC SnapIn sample referenced in AIP.
(4 KiB) Downloaded 567 times
jstart
Posts: 18
Joined: Fri Apr 17, 2015 10:48 am

Re: Crash seen in MMC if snap-in in use during uninstall

**** Further update: ****

I can repro this using a simple C++ ATL sample SnapIn (32bit) and a new AI installer that registers the DLL.
Similar event log and problem signatures as before:

Faulting application name: mmc.exe, version: 6.3.9600.16384, time stamp: 0x52158765
Faulting module name: DUser.dll, version: 6.3.9600.16384, time stamp: 0x5215778e
Exception code: 0xc000041d
Fault offset: 0x0000118a
Faulting process id: 0x293c
Faulting application start time: 0x01d1811ecfc807b2
Faulting application path: C:\Windows\SysWOW64\mmc.exe
Faulting module path: C:\Windows\SYSTEM32\DUser.dll
Report Id: 9e85d96b-ed12-11e5-80c0-00155d013578
Faulting package full name:
Faulting package-relative application ID:

Fault bucket , type 0
Event Name: APPCRASH
Response: Not available
Cab Id: 0

Problem signature:
P1: mmc.exe
P2: 6.3.9600.16384
P3: 52158765
P4: DUser.dll
P5: 6.3.9600.16384
P6: 5215778e
P7: c0000005
P8: 0000118a
P9:
P10:

Attached files:

These files may be available here:
C:\Users\Administrator.JIM0\AppData\Local\Microsoft\Windows\WER\ReportArchive\AppCrash_mmc.exe_498ee7526cf85659a687e58ea48e922205e5b_b6b44108_324eaf8b

Analysis symbol:
Rechecking for solution: 0
Report Id: 825963d4-ed12-11e5-80c0-00155d013578
Report Status: 2048
Hashed bucket:

Problem Event Name: APPCRASH
Application Name: mmc.exe
Application Version: 6.3.9600.16384
Application Timestamp: 52158765
Fault Module Name: DUser.dll
Fault Module Version: 6.3.9600.16384
Fault Module Timestamp: 5215778e
Exception Code: c0000005
Exception Offset: 0000118a
OS Version: 6.3.9600.2.0.0.272.7
Locale ID: 2057
Additional Information 1: 6ed5
Additional Information 2: 6ed5ecaa8d241bc68ef31b8fca14f466
Additional Information 3: 305c
Additional Information 4: 305ce29e85090b2d8414d5c9efdf93df

Problem signature:
Problem Event Name: APPCRASH
Application Name: mmc.exe
Application Version: 6.3.9600.16384
Application Timestamp: 52158765
Fault Module Name: DUser.dll
Fault Module Version: 6.3.9600.16384
Fault Module Timestamp: 5215778e
Exception Code: c000041d
Exception Offset: 0000118a
OS Version: 6.3.9600.2.0.0.272.7
Locale ID: 2057
Additional Information 1: 1efb
Additional Information 2: 1efb9cd412897a2580c5bc80412ada1c
Additional Information 3: ba9f
Additional Information 4: ba9f6706b459f3aeecd3f782fc101815
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Crash seen in MMC if snap-in in use during uninstall

Hello,

I've tested the attached example files on a Windows Server 2002 R2 machine, but I didn't replicated the crash. However, please note that in order to avoid the "FileInUse" dialog, and therefore any subsequent issues which may be caused by the Windows Installer mechanism of detecting and stopping the processes keeping installation file in use, you should use our "Terminate Process" custom action to close the "mmc.exe" process on uninstall.

Just go to "Custom Actions" page and add a "Terminate Process" custom action without sequence, before "Install Execution Stage -> Preparing" action group, like this:
  • Process name: mmc.exe
only on uninstall.

Let us know if this helped.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
jstart
Posts: 18
Joined: Fri Apr 17, 2015 10:48 am

Re: Crash seen in MMC if snap-in in use during uninstall

Hi Daniel,

Thanks for the reply.
Please confirm which server you tested it on, as you mention "Windows Server 2002 R2".

The issue doesn't always happen (1:2), but we've seen it on several (5+) Windows Server 2012 R2 virtual machines and Windows 2008 R2 - these are different machines belonging to different people.
Try expanding the SnapIn node, then uninstall.
My Windows Server 2012 R2 Standard virtual machine is in a WORKGROUP, with no other software installed and will repro issue with no MS Windows updates and with important MS Windows updates applied.
My Windows Server 2008 R2 Enterprise SP1 machine repro'ing issue is a standalone DC with VS2008/2010 dev tools installed – my native managed code test installation throw up the VS2010 debugger which listed a heap corruption and this stack:

> ntdll.dll!77ba15ee()
[Frames below may be incorrect and/or missing, no symbols loaded for ntdll.dll]
ntdll.dll!77ba15ee()
ntdll.dll!77c285ab()
ntdll.dll!77c4e5e6()
ntdll.dll!77c4e663()
ntdll.dll!77bf20b4()
ntdll.dll!77bf1f59()
ntdll.dll!77bc6ab9()
ntdll.dll!77bc6a8b()
ntdll.dll!77bc6a2d()
ntdll.dll!77b90143()
mmc.exe!00069eaf()
mmc.exe!00069df3()
user32.dll!764662fa()
user32.dll!76466d91()
user32.dll!76466de8()
user32.dll!76466df3()
KernelBase.dll!75cfa55b()
mmc.exe!000b26be()
mmc.exe!000b03c6()
mfc42u.dll!752d542f()
mfc42u.dll!752cf84d()
mmc.exe!0006c107()
mmc.exe!0009f7d1()
kernel32.dll!759b33ca()
ntdll.dll!77bb9ed2()
ntdll.dll!77bb9ea5()

I will investigate your suggestion, however TerminateProcess is a risky/nasty method, especially as there could be multiple instances of mmc.exe running.
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Crash seen in MMC if snap-in in use during uninstall

Hello,

I apologize, there was a typo in my previous reply. I've tested the scenario on a Windows Server 2012 R2 machine.

I've run a few more tests on the Windows Server 2012 R2 machine and I was able to replicate the issue. It seems this may happen indeed due to the Windows Installer closing operation of the mmc.exe process. Unfortunately, the only way to avoid the process closing operation during uninstall will be to develop your own custom action which will check if your snap-in is loaded and if so unload it (if possible) or prompt the user to unload it before proceeding with the uninstall. The custom action should be added on uninstall before "Install Execution Stage -> Preparing" action group.

If there is anything we can assist you with just let us know.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
jstart
Posts: 18
Joined: Fri Apr 17, 2015 10:48 am

Re: Crash seen in MMC if snap-in in use during uninstall

Hi,

I’ve tried your suggestion – my implementation pops up a message box telling the user to close a list of mmc(s) that have our snap-in loaded. This works to a degree, the issue comes in the following scenario:

1) Install our product.
2) Run mmc (64bit) and add any snap-in (e.g. DNS) + Our snap-in.
3) Start to uninstall our product.
4) Get our message to close “mmc / Console1” – this is waiting for the OK button to be pressed.
5) On the mmc containing the two snap-ins, remove our snap-in, but leave the other snap-in (DNS) present.
6) Press OK on the uninstall dialog shown in 4).
7) Now the installer dialog “The following applications should be closed before continuing the install: Microsoft Management Console” is shown, followed by two installer crashes as originally raised in this bug!
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Crash seen in MMC if snap-in in use during uninstall

Hello,

I tested the scenario, but I cannot replicate the behavior at all. Can you please send us again the .AIP (project file) and a download link to its built setup to support at advancedinstaller dot com so we can test and investigate them?

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”