Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
sam-vdp opened this issue Apr 26, 2021 · 5 comments
Open

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

sam-vdp opened this issue Apr 26, 2021 · 5 comments

Comments

@sam-vdp
Copy link

sam-vdp commented Apr 26, 2021

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
Copy link
Member

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
Copy link
Author

sam-vdp commented Apr 26, 2021

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
Copy link

wngr commented Apr 29, 2021

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
Copy link
Member

Will try to reproduce with you script above...

@wngr
Copy link

wngr commented Apr 30, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants