GsNSIS / EnVar

EnVar plugin for NSIS
Other
8 stars 4 forks source link

NSIS Uninstaller hangs if EnVar plugin and Banner are called #10

Open sam-vdp opened 3 years ago

sam-vdp commented 3 years ago

I suspect this may be an issue with NSIS rather than EnVar, but I am not sure, so I am posting here for now.

When calling both EnVar and Banner from an unattended uninstaller, very often the uninstaller will hang after completing its work, with full CPU use on one thread. I cannot say exactly where the freeze occurs, but is after the un.onUninstSuccess handler is completed.

Minimal reproduction case (used NSIS version is 3.06.1, EnVar 0.3.1):

Unicode True

InstallDir $PROGRAMFILES64\Test

!include MUI2.nsh

OutFile "../out/test_installer.exe"

!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH

!insertmacro MUI_LANGUAGE "English"

RequestExecutionLevel admin

Function .onInit
  SetRegView 64
FunctionEnd

Function un.PerformUninstall
  SetRegView 64

  SetAutoClose true

  ; Commenting either of the next two lines fixes the freeze
  Banner::destroy    
  EnVar::SetHKLM

  Delete "$INSTDIR\uninstall.exe"
  RMDir "$INSTDIR"
FunctionEnd

Section "Uninstall"
  Call un.PerformUninstall
SectionEnd

Function un.onUninstFailed
  MessageBox MB_OK "Uninstallation failed." /SD IDOK
FunctionEnd

Section 
  SetOverwrite On

  CreateDirectory "$INSTDIR"

  WriteUninstaller "$INSTDIR\uninstall.exe"

  EnVar::SetHKLM
SectionEnd

Can be tested with a batch script like this:

@echo off

:start
echo Installing...

start "" /WAIT test_installer.exe /S

echo.   Removing...
start "" /WAIT "C:\Program Files\Test\uninstall.exe" /S _?=C:\Program Files\Test

echo.
goto start

EDIT: Appending /NOUNLOAD to the Banner::destroy fixes the issue

gilbertsoft commented 3 years ago

Thanks for your report. I hardly guess your issue is not related to the EnVar plugin, also your edit seems to confirm my assumption.

I'm aware of the issue with the hanging uninstaller, if I recall correctly I also had this issue without the EnVar plugin. But here it's not a permanent issue, sometimes it works, sometime the install hangs at the end.

Is it okay for you closing this issue?

sam-vdp commented 3 years ago

Well, the issue didn't appear until we added EnVar to our installer. We are only using to modify the PATH variable without the NSIS 1024 character limitation. I will try to generate repro case with only EnVar, but for now we will just revert to our previous version without EnVar. Feel free to close this bug.

wngr commented 3 years ago

This is happening to us as well. Sometimes the installer's (never had it with the uninstaller though) process just sits there after the interactive window is closed. Also happens in silent mode.

gilbertsoft commented 3 years ago

Will try to reproduce with you script above...

wngr commented 3 years ago

I wonder whether there are any asynchronous calls within this library? Might be that the dll is not unloaded ..