Bug #61792 Installer shows AV when trying to remove server data files while they are in use
Submitted: 7 Jul 2011 22:19 Modified: 11 Jul 2011 17:51
Reporter: Johannes Taxacher Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL for Windows: Installer Severity:S3 (Non-critical)
Version:5.5.14.0 OS:Microsoft Windows
Assigned to: Iggy Galarza CPU Architecture:Any

[7 Jul 2011 22:19] Johannes Taxacher
Description:
When installer tries to remove the data files and they happen to be in use (because of an err on server removal so that service is still running or a data file is opened/locked by some other app)
installer runs into an exception and displays windwos AV dialog:

See the end of this message for details on invoking 
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.IO.IOException: The process cannot access the file 'C:\Documents and Settings\All Users\Application Data\MySQL\MySQL Server 5.5\data\ib_logfile0' because it is being used by another process.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.File.Delete(String path)
   at WexInstaller.RemoveComplete.DeleteDirectory(String target)
   at WexInstaller.RemoveComplete.DeleteDirectory(String target)
   at WexInstaller.RemoveComplete.Next()
   at WexInstaller.RemoveControl.Next_Click(Object sender, EventArgs e)
   at System.Windows.Forms.Control.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ButtonBase.WndProc(Message& m)
   at System.Windows.Forms.Button.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

************** Loaded Assemblies **************
mscorlib
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
    CodeBase: file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
WexInstaller
    Assembly Version: 1.0.15.0
    Win32 Version: 1.0.15.0
    CodeBase: file:///C:/Program%20Files/MySQL/MySQL%20Installer/MySQLInstaller.exe
----------------------------------------
WexInstaller.Core
    Assembly Version: 1.0.4.0
    Win32 Version: 1.0.4.0
    CodeBase: file:///C:/Program%20Files/MySQL/MySQL%20Installer/WexInstaller.Core.DLL
----------------------------------------
System.Windows.Forms
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Configuration
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Xml
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
zfm1of4y
    Assembly Version: 1.0.4.0
    Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
x2oddwwh
    Assembly Version: 1.0.4.0
    Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Management
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Management/2.0.0.0__b03f5f7f11d50a3a/System.Management.dll
----------------------------------------
StandardPlugins
    Assembly Version: 1.0.5.0
    Win32 Version: 1.0.5.0
    CodeBase: file:///C:/Program%20Files/MySQL/MySQL%20Installer/StandardPlugins.DLL
----------------------------------------
System.ServiceProcess
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.ServiceProcess/2.0.0.0__b03f5f7f11d50a3a/System.ServiceProcess.dll
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
    <system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.

How to repeat:
- uninstall server package using installer
- select "remove server data files"
- block one of the log files (e.g. Application Data\MySQL\MySQL Server 5.5\data\ib_logfile0) by opening it with a app that locks the file during use
- click "finish" button in installer and click "OK" on the following two confirmation dialogs
after the second confirmation dialog is confirmed, the err pops up

Suggested fix:
don't make it display an AV but rather a graceful "cannot delete file xy because its in use by another process" or sth alike.
[11 Jul 2011 17:51] Johannes Taxacher
fix confirmed in latest RC candidate build 5.5.14.0