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

On Windows, running app not quit when uninstalling the app but uninstallation just completed #7493

Closed
kafka-yu opened this issue Mar 23, 2023 · 22 comments
Labels

Comments

@kafka-yu
Copy link

kafka-yu commented Mar 23, 2023

Hi team,

we find a strange issue: When uninstalling, the running app is not able to quit automatically. The uninstallation is completed fast. And the files are deleted except the files that are app running used.

The package below config to pack the app, and with a custom NSIS script to do "customInstall" and "customUninstall" steps.

  nsis: {
         include: "./scripts/nsis.custom.installer.nsh",
        uninstallDisplayName: "Test App",
        allowToChangeInstallationDirectory: true,
        createStartMenuShortcut: true,
        runAfterFinish: true,
        oneClick: false,
        warningsAsErrors: false, // delete registry key may show warning, ignore it
        differentialPackage: false,
      },
      win: {
        icon: "win.ico",
        certificateFile: certification.certificate,
        certificatePassword: certification.password,
        signingHashAlgorithms: [certification.algorithm],
        rfc3161TimeStampServer: certification.rfcTimestamp,
        protocols: appConfig.protocols,
      },

The installer.nsh file content:

!define SCHEMENAME "test-app-open-plugin" #URL Protocol

!macro customInstall
  DetailPrint "Register ${SCHEMENAME} URI Handler"
  DeleteRegKey HKCU "Software\Classes\${SCHEMENAME}"
  WriteRegStr HKCU "Software\Classes\${SCHEMENAME}" "" "${PRODUCT_NAME}"
  WriteRegStr HKCU "Software\Classes\${SCHEMENAME}" "URL Protocol" ""
  WriteRegStr HKCU "Software\Classes\${SCHEMENAME}\DefaultIcon" "" "$INSTDIR\${APP_EXECUTABLE_FILENAME}"
  WriteRegStr HKCU "Software\Classes\${SCHEMENAME}\shell" "" ""
  WriteRegStr HKCU "Software\Classes\${SCHEMENAME}\shell\Open" "" ""
  WriteRegStr HKCU "Software\Classes\${SCHEMENAME}\shell\Open\command" "" "$INSTDIR\${APP_EXECUTABLE_FILENAME} %1"
!macroend

!macro customUnInstall
  DeleteRegKey HKCU "Software\Classes\${SCHEMENAME}"
!macroend

Does anyone know the reason?

  • Electron-Builder Version: 23.6.0
  • Node Version:
  • Electron Version: 20.0.0
  • Electron Type (current, beta, nightly): current
  • Target: nsis, Windows
@kafka-yu kafka-yu changed the title Windows not able to quit running app when uninstalling the app On Windows, not able to quit running app when uninstalling the app Mar 23, 2023
@kafka-yu kafka-yu changed the title On Windows, not able to quit running app when uninstalling the app On Windows, running app not quit when uninstalling the app but uninstallation just completed Mar 24, 2023
@mmaietta
Copy link
Collaborator

mmaietta commented Mar 26, 2023

What electron-updater version are you using? Was this working previously?

@kafka-yu
Copy link
Author

What electron-updater version are you using? Was this working previously?

the version of electron-updater is at: ^5.3.0. Yeah it worked previously, Recently we add customUninstall nsh script to delete Registry Keys, but it doesn't work even this part is reverted.

@kafka-yu
Copy link
Author

do you have any other insights?

@mmaietta
Copy link
Collaborator

I don't know enough about nsh scripting (or windows development) to be able to provide insights there.
My best advice is that this warningsAsErrors: false is hiding an issue with the new uninstaller script

@kafka-yu
Copy link
Author

kafka-yu commented Apr 1, 2023

hmm,, I tried removing that customized nsis stuff, and test in a clean Windows VM, but still no luck.

Downgrade to electron-builder 23.3.0 is also not working.

I've another app uses 22.11.11, it works correctly.

UPDATE:
I downgrade to 22.11.11 with the above config, which is also working!! During uninstalling, it will ask to Close the running app.

@kafka-yu
Copy link
Author

kafka-yu commented Apr 1, 2023

Is there any way to enable logs on windows? I checked some issues e.g. brimdata/zui#2713 but seems not solution.. Maybe I should upgrade to 24.1.2 to have a try?

24.1.2 still not working either.

@mmaietta
Copy link
Collaborator

mmaietta commented Apr 1, 2023

You'll need to provide your own custom nsis binary that supports debug logging. (I tried to build it in directly to electron-builder, but 3.0.4.2 nsis was throwing off alerts from antivirus programs, so we are stuck with 3.0.4.1

https://github.com/electron-userland/electron-builder/blob/master/packages/app-builder-lib/src/targets/nsis/nsisOptions.ts#L55

/**
   * Allows you to provide your own `makensis`, such as one with support for debug logging via LogSet and LogText. (Logging also requires option `debugLogging = true`)
   */
  readonly customNsisBinary?: CustomNsisBinary | null

Quick link to the interface below:

@kafka-yu
Copy link
Author

kafka-yu commented Apr 2, 2023

Thanks @mmaietta I got> "Error: LogSet specified, NSIS_CONFIG_LOG not defined." when I set

 {
 url: 'https://github.com/electron-userland/electron-builder-binaries/releases/download',
  debugLogging: true,
  checksum:
    'VKMiizYdmNdJOWpRGz4trl4lD++BvYP2irAXpMilheUP0pc93iKlWAoP843Vlraj8YG19CVn0j+dCo/hURz9+Q==',
  version: '3.0.4.1',
}

Tried "nsis-3.0.8-log", and now it can output logs. I saw it tries to remove the Exe file directly, but no logs say it is checking the app running or not.

Delete: DeleteFile failed("C:\Users**\AppData\Local\Programs\Test app plugin\Test app plugin.exe")

BTW, do you know why 22.11.11 works?

I checked the changes history between 22.11.11 ---> 23.6.0, only some MRs merged:

Those MRs changed the "uninstall.nsh", but not sure which one.

@mmaietta
Copy link
Collaborator

mmaietta commented Apr 2, 2023

https://github.com/electron-userland/electron-builder/pull/6024/files
Uses 3.0.4.2 makensis which has debug compiler flag available, but the change had to be reverted due to the anti-virus issue mentioned earlier.
3.0.4.1 does not have the debug compiler flag

@kafka-yu
Copy link
Author

kafka-yu commented Apr 8, 2023

Here is the log file, would you pls help a look? Thanks.

The error I saw is:

Delete: DeleteFile failed("C:\Users\test\AppData\Local\Programs\Test app plugin\Test app plugin.exe")

Looks like the app not quit before deleting..

install.log

@kafka-yu
Copy link
Author

@mmaietta would you pls help check the above logs? thanks.

@mmaietta
Copy link
Collaborator

In all honesty, I have no idea how nsis works or am able to debug installers. I did take a look at the install.log file for you, but I don't know what I'm reading

@kafka-yu
Copy link
Author

kafka-yu commented Apr 23, 2023

@mmaietta I found something that, If I changed the product name to another one, then it works.

E.g. If it is named "Desktop Plugin" it works, but if changed to name ("RingCentral Desktop Plugin"), it is not working. Is there a bug in the process name comparing? Since if I changed to electron-builder: 22.11.11, both work.

Those names work:

  • Next Plugin
  • Next for Plugin
  • Desktop Plugin

Those names do not work:

  • Centralize for Desktop Plugin
  • Next for Desktop Plugin

image

@kafka-yu
Copy link
Author

kafka-yu commented Apr 23, 2023

@indutny @lwintermelon do you have any idea about this issue? Would you please help check? Since I saw last last time you did some changes on uninstaller part. Appricated. Thanks!

@unzld
Copy link

unzld commented Apr 27, 2023

@kafka-yu could you provide the customNsisBinary setting that you used to enable logging?

@lwintermelon
Copy link
Contributor

@indutny @lwintermelon do you have any idea about this issue? Would you please help check? Since I saw last last time you did some changes on uninstaller part. Appricated. Thanks!

Sorry for the late reply. The issus is very similar to what I fixed on #6100, maybe you can check this PR and try to fix the issue.

@kafka-yu
Copy link
Author

kafka-yu commented May 6, 2023

thanks for your reply! @lwintermelon I checked but have no idea about the fixing solution, could you pls give some hints about this part? Thank you!

@github-actions
Copy link
Contributor

github-actions bot commented Jun 6, 2023

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot added the Stale label Jun 6, 2023
@github-actions
Copy link
Contributor

This issue was closed because it has been stalled for 5 days with no activity.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jun 11, 2023
@repl-minatee-p
Copy link

repl-minatee-p commented Sep 18, 2023

I am also facing the same issue after I changed the product name.
@kafka-yu Did you find any solution for this issue ?

Electron-Builder Version : 23.6.0
Electron-Updater Version: 5.3.0
Electron Version: 24.6.5

@Quincysacc
Copy link

I am having this issue. I uninstalled it, and i kept getting a popup saying, "electron.exe System error" something about dll, and how I had to reinstall the app to fix the issue. But seeing as I'd get this popup every time I turned on my PC. I knew it was running in the background causing the popups. For me what fixed it, I just opened task manager and found that electron was somehow still running in the background, I just selected it after closing the popup, and deleted it from the task manager menu. Hopefully this helps someone else.

@Quincysacc
Copy link

Hopefully you found the issue, did you try to open task manager to see if it was somehow running in the background?

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

No branches or pull requests

6 participants