electron-builder icon indicating copy to clipboard operation
electron-builder copied to clipboard

Auto Updater EPERM Issues

Open ThatKawaiiSam opened this issue 9 months ago • 10 comments

  • Electron-Builder Version: 24.6.4
  • Node Version: 18.15.0
  • Electron Version: 25.3.0
  • Electron Type (current, beta, nightly): current
  • Target: Windows, macOS, Linux

We have Sentry enabled throughout our Application and have noticed a considerable amount of errors with the Auto Updater in regards to some update files operations not being permitted.

Screenshot 2023-09-16 at 11 44 29 pm

We do not modify any of the core functionality of the updater and use it mostly out of the box with a few additions around when quitAndInstall() is called ensuring that we don't update when in the dock.

Happy to provide any additional context if needed.

ThatKawaiiSam avatar Sep 16 '23 13:09 ThatKawaiiSam

Are you distributing both portable and nsis targets? Can you please post your electron-builder config?

mmaietta avatar Sep 19 '23 22:09 mmaietta

@mmaietta I had the same issue, my sentry log is like that: Electron-Builder Version: 23.6.0 Node Version: 16.17.1 Electron Version: 19.0.0 Electron Type (current, beta, nightly): current Target: Windows, macOS image

all of this error happened on Windows image

my packaging config is blow: "nsis": { "oneClick": false, "perMachine": false, "allowToChangeInstallationDirectory": true, "shortcutName": OKKI${ENV_NAME}, "include": "./scripts/installer.nsh", "differentialPackage": false, "packElevateHelper": true, "guid": OKKI${ENV_NAME} }, "win": { "target": [ { "target": "nsis", "arch": [ "ia32", "x64" ] } ], "signingHashAlgorithms":['sha1', 'sha256'], "sign": "./scripts/signWin.js", "verifyUpdateCodeSignature": false, "signDlls": true, "timeStampServer": "http://timestamp.digicert.com" },

okkidev01 avatar Sep 21 '23 01:09 okkidev01

Are you distributing both portable and nsis targets? Can you please post your electron-builder config?

Here is the builder-effective-config.yaml

directories:
  output: release
  buildResources: build
generateUpdatesFilesForAllChannels: true
appId: com.moonsworth.client
extraMetadata:
  version: 3.1.0
productName: Lunar Client
files:
  - filter:
      - build/**/*
      - dist/**/*
      - dist-electron/**/*
      - '!**/node_modules/*/{CHANGELOG.md,README.md,README,readme.md,readme}'
      - '!**/node_modules/*/{test,__tests__,tests,powered-test,example,examples}'
      - '!**/node_modules/*.d.ts'
      - '!**/node_modules/.bin'
      - '!**/*.{iml,o,hprof,orig,pyc,pyo,rbc,swp,csproj,sln,xproj}'
      - '!.editorconfig'
      - '!**/._*'
      - '!**/{.DS_Store,.git,.hg,.svn,CVS,RCS,SCCS,.gitignore,.gitattributes}'
      - '!**/{__pycache__,thumbs.db,.flowconfig,.idea,.vs,.nyc_output}'
      - '!**/{appveyor.yml,.travis.yml,circle.yml}'
      - '!**/{npm-debug.log,yarn.lock,.yarn-integrity,.yarn-metadata.json}'
      - '!**/node_modules/typescript/**/*'
      - '!**/node_modules/register-scheme/**/*'
protocols:
  - name: lunarclient
    schemes:
      - lunarclient
win:
  target: nsis-web
  icon: build/icon.png
  signingHashAlgorithms:
    - sha256
  sign: ./winSign.js
mac:
  category: public.app-category.games
  hardenedRuntime: true
  artifactName: ${productName} v${version}.${ext}
  entitlements: build/entitlements.plist
  entitlementsInherit: build/entitlements.plist
  target:
    - dmg
    - zip
  icon: build/icon-macos.png
  notarize: {}
linux:
  target: AppImage
dmg:
  title: Lunar Client
  writeUpdateInfo: false
  window:
    width: 1000
    height: 776
  iconSize: 120
  contents:
    - x: 296
      'y': 496
    - x: 704
      'y': 496
      type: link
      name: Applications
      path: /Applications
nsisWeb:
  oneClick: true
  perMachine: false
  license: build/license_en.txt
  artifactName: ${productName} v${version}.${ext}
  installerIcon: build/icon-installer.ico
  uninstallerIcon: build/icon-uninstaller.ico
  installerHeaderIcon: build/icon.ico
  uninstallDisplayName: Uninstall ${productName}
  installerSidebar: build/sidebar.bmp
  uninstallerSidebar: build/sidebar.bmp
  differentialPackage: false
publish:
  - provider: generic
    url: https://launcherupdates.lunarclientcdn.com
    publishAutoUpdate: true
    useMultipleRangeRequest: false
electronVersion: 25.3.0

ThatKawaiiSam avatar Oct 01 '23 03:10 ThatKawaiiSam

@mmaietta do you need any more information?

ThatKawaiiSam avatar Oct 22 '23 22:10 ThatKawaiiSam

Idk tbh. I was hoping it was due to portable being used as I recall there being a caveat with it. Since it's nsis-web, I have no idea what could be causing it. I personally am not able to debug it any further on my arm64 mac though. Will need community members to debug it and propose a solution. electron-builder currently detects some error responses, but it's not inclusive of EPERM. https://github.com/electron-userland/electron-builder/blob/4c9b8296b9104a28ad9bccf643eec3d6c0dff6ab/packages/electron-updater/src/NsisUpdater.ts#L162-L170 Not sure how to handle EPERM on Windows.

For AppImage updates, we just use chmod https://github.com/electron-userland/electron-builder/blob/master/packages/electron-updater/src/AppImageUpdater.ts#L71

Any ideas on how we can attend to EPERM issues?

mmaietta avatar Oct 23 '23 17:10 mmaietta

Idk tbh. I was hoping it was due to portable being used as I recall there being a caveat with it. Since it's nsis-web, I have no idea what could be causing it. I personally am not able to debug it any further on my arm64 mac though. Will need community members to debug it and propose a solution. electron-builder currently detects some error responses, but it's not inclusive of EPERM.

https://github.com/electron-userland/electron-builder/blob/4c9b8296b9104a28ad9bccf643eec3d6c0dff6ab/packages/electron-updater/src/NsisUpdater.ts#L162-L170

Not sure how to handle EPERM on Windows. For AppImage updates, we just use chmod https://github.com/electron-userland/electron-builder/blob/master/packages/electron-updater/src/AppImageUpdater.ts#L71

Any ideas on how we can attend to EPERM issues?

I did read in another issue that it may be potentially due to a race condition with checking the update twice, although we do have a locking mechanism within our application and were not able to reproduce: https://github.com/electron-userland/electron-builder/issues/5408#issuecomment-1705086586

ThatKawaiiSam avatar Oct 28 '23 00:10 ThatKawaiiSam

Just wanted to bump this as we did another production deploy of our application today. We also see EBUSY errors aswell as per the screenshot:

Screenshot 2023-12-31 at 5 34 27 pm

ThatKawaiiSam avatar Dec 31 '23 06:12 ThatKawaiiSam

Does anyone know if there is a way to detect via javascript whether a resource is no longer locked? I'm not familiar with EPERM

mmaietta avatar Jan 16 '24 17:01 mmaietta

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

github-actions[bot] avatar Apr 22 '24 00:04 github-actions[bot]

Not entirely sure but thought I would just mention that this is still an ongoing issue

ThatKawaiiSam avatar May 16 '24 06:05 ThatKawaiiSam