bugsnag/bugsnag-js

@bugsnag/electron in main process hangs or crashes on Linux with Electron v26+

phoenixwong opened this issue · 4 comments

Describe the bug

We've implemented BugSnag in our Electron app for a while, and it works excellently with Electron v23, v24, and v25 across MacOS/Windows/Linux platforms. However, with Electron v26, the Bugsnag.start($OPTION) either hangs or causes an immediate crash of the app in Linux (Ubuntu 22 LTS).

Steps to reproduce

  1. In any Electron project that uses Electron v25 or below with @bugsnag/electron, upgrade the Electron package to v26 - Ensure the app builder modules are under the latest version compatible with v26.
  2. Try running your project in Linux, either in development mode or a generated build.
  3. Here the error happens --
  • 3-A. On a physical device, the app hangs in the line Bugsnag.start($OPTION). There's no error throwing out, but the lines after Bugsnag.start($OPTION) are never executed
  • 3-B. On the virtual machine, the app crashes right after executing Bugsnag.start($OPTION) with the following errors --
[0915/041701.496328:ERROR:file_io_posix.cc(144)] open /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq: No such file or directory (2)
[0915/041701.496755:ERROR:file_io_posix.cc(144)] open /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq: No such file or directory (2)
  1. Downgrade the Electron back to v25 or lower (e.g., v23, v24)
  2. Rebuild and rerun your app without changing any codes.
  3. The error is gone. Both your app and Bugsnag are running smoothly again.

Environment

  • Bugsnag version: @bugsnag/electron 7.20.0 and 7.21.0
  • Electron framework version
    • 26.x.y
    • 27.x.y (beta version at this moment)
  • Linux version: Ubuntu 22 LTS

Example code snippet

// In Electron Main process

import Bugsnag from '@bugsnag/electron'

// ...

console.log('Starting BugSnag [Main process]')

Bugsnag.start($YOUR_OPTIONS)

console.log('Main process BugSnag started')

// ... the rest code blocks
Expected Outputs In The Main Process
Starting BugSnag [Main process]
[bugsnag][main] Loaded! In main process.
Main process BugSnag started
# followed by outputs from the remaining scripts.

Outputs from an actual (physical) device

Starting BugSnag [Main process]
# Nothing else. The app hangs there.

Outputs from a virtual machine

Starting BugSnag [Main process]
[0915/041701.496328:ERROR:file_io_posix.cc(144)] open /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq: No such file or directory (2)
[0915/041701.496755:ERROR:file_io_posix.cc(144)] open /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq: No such file or directory (2)
# -> App crashed

That sounds problematic as Electron team only supports latest three stable major versions

That sounds problematic as Electron team only supports latest three stable major versions

Yup. Time is ticking.

If we remove (comment out) the BugSnag, everything works well under Electron v26 and v27.

To keep using BugSnag in the Linux app, we must downgrade Electron to 25.x.y, the last supported version.

mclack commented

Hi @phoenixwong & @trungutt

Apologies for the delay in response. We now have a fix for this, which is scheduled for the next release of bugsnag-js.

Thanks for bringing this to our attention. We will make sure to update this thread once v7.22.1 is available.

clr182 commented

Hi

We have just released Bugsnag-js v7.22.1 which should fix main process hangs or crashes for electron v26+. After updating, if you are still seeing issues please let us know.