nwjs / nw.js

Call all Node.js modules directly from DOM/WebWorker and enable a new way of writing applications with all Web technologies.
https://nwjs.io
MIT License
40.24k stars 3.88k forks source link

Segmentation fault when calling `chrome.privacy.services.autofillEnabled.set` #8195

Closed skylarmt closed 1 week ago

skylarmt commented 2 weeks ago

Issue Type

Before opening an issue, please search and see if it has already been raised.

Current/Missing Behavior

NW.js segfaults immediately upon running chrome.privacy.services.autofillEnabled.set. Other chrome.privacy settings do not cause this.

Expected/Proposed Behavior

Doesn't kill itself.

Additional Info

package.json:

{
"name": "segfault",
"main": "main.js"
}

main.js that segfaults:

chrome.privacy.services.passwordSavingEnabled.set({value: false});
chrome.privacy.services.autofillEnabled.set({value: false});
chrome.privacy.services.spellingServiceEnabled.set({value: false});

main.js that doesn't segfault:

chrome.privacy.services.passwordSavingEnabled.set({value: false});
// chrome.privacy.services.autofillEnabled.set({value: false});
chrome.privacy.services.spellingServiceEnabled.set({value: false});

From clean Kubuntu 22.04.1 amd64 live CD virtual machine:

[0706/200655.672351:ERROR:elf_dynamic_array_reader.h(64)] tag not found
[0706/200655.675871:ERROR:file_io_posix.cc(145)] open /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq: No such file or directory (2)
[0706/200655.675888:ERROR:file_io_posix.cc(145)] open /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq: No such file or directory (2)
[5924:5924:0706/200655.791034:FATAL:nw_content_renderer_hooks.cc(53)] Failed to load node library (error: libatomic.so.1: cannot open shared object file: No such file or directory)
#0 0x7fa6db6616ae (/usr/lib/nw.js/lib/libnw.so+0x6f426ad)
#1 0x7fa6db5bbcec (/usr/lib/nw.js/lib/libnw.so+0x6e9cceb)
#2 0x7fa6db5bc7f9 (/usr/lib/nw.js/lib/libnw.so+0x6e9d7f8)
#3 0x7fa6e16779e9 (/usr/lib/nw.js/lib/libnw.so+0xcf589e8)
#4 0x7fa6e148f37f (/usr/lib/nw.js/lib/libnw.so+0xcd7037e)
#5 0x7fa6daace9d3 (/usr/lib/nw.js/lib/libnw.so+0x63af9d2)
#6 0x7fa6daacfa35 (/usr/lib/nw.js/lib/libnw.so+0x63b0a34)
#7 0x7fa6daacd1f1 (/usr/lib/nw.js/lib/libnw.so+0x63ae1f0)
#8 0x7fa6daacd817 (/usr/lib/nw.js/lib/libnw.so+0x63ae816)
#9 0x7fa6d6cb82e6 ChromeMain
#10 0x7fa6d44e3d90 (/usr/lib/x86_64-linux-gnu/libc.so.6+0x29d8f)
Crash keys:
  "reentry_guard_tls_slot" = "unused"
  "switch-18" = "--user-data-dir=/home/kubuntu/.config/nwjstest"
  "switch-17" = "--variations-seed-version"
  "switch-16" = "--field-trial-handle=3,i,16711768569668566194,716485908521596859"
  "switch-15" = "--shared-files=v8_context_snapshot_data:100"
  "switch-14" = "--launch-time-ticks=2958044738"
  "switch-13" = "--time-ticks-at-unix-epoch=-1720293457694728"
  "switch-12" = "--renderer-client-id=6"
  "switch-11" = "--num-raster-threads=1"
  "switch-10" = "--lang=en-US"
  "switch-9" = "--no-zygote"
  "switch-8" = "--no-sandbox"
  "switch-7" = "--change-stack-guard-on-fork=enable"
  "switch-6" = "--extension-process"
  "switch-5" = "--nwjs"
  "switch-4" = "--nwapp-path=."
  "switch-3" = "--user-data-dir=/home/kubuntu/.config/nwjstest"
  "switch-2" = "--enable-crash-reporter=,"
  "switch-1" = "--crashpad-handler-pid=5855"
  "num-switches" = "19"
  "osarch" = "x86_64"
  "pid" = "5924"
  "ptype" = "renderer"

[0706/200655.798822:ERROR:file_io_posix.cc(145)] open /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq: No such file or directory (2)
[0706/200655.798840:ERROR:file_io_posix.cc(145)] open /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq: No such file or directory (2)
[5922:5922:0706/200655.860030:ERROR:viz_main_impl.cc(166)] Exiting GPU process due to errors during initialization

Note that the path of libnw.so is due to NW.js being installed from a .deb package I maintain, which just packages binary releases from nwjs.io and installs them in /usr/lib/nw.js/.

ayushmanchhabra commented 2 weeks ago
[5924:5924:0706/200655.791034:FATAL:nw_content_renderer_hooks.cc(53)] Failed to load node library (error: libatomic.so.1: cannot open shared object file: No such file or directory)

@skylarmt Do you have libatomic installed?

skylarmt commented 1 week ago

@skylarmt Do you have libatomic installed?

Yes, at least on my dev machine, which had the same crash but with a less helpful stacktrace (unlike the VM, I think it's missing a utility that helps make useful bug report stack traces).

~$ sudo apt install libatomic1
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
libatomic1 is already the newest version (12.3.0-1ubuntu1~22.04).
libatomic1 set to manually installed.

Looks like it was missing from the VM though, and installing it there maybe helps?

skylarmt commented 1 week ago

Another thing to note is this only seems to occur when an app hasn't successfully launched before. Deleting its data folder in ~/.config causes the bug again. I recall running into this crash on a laptop a few months ago, but assumed the laptop was just old and had some incompatibility, so I downgraded NW.js by a year or two and whatever version that was didn't crash.

imawizrd commented 1 week ago

Note that autofillEnabled is marked as deprecated in the types: "since Chrome 70. Please use privacy.services.autofillAddressEnabled and privacy.services.autofillCreditCardEnabled."

skylarmt commented 1 week ago

It shouldn't segfault though.

ayushmanchhabra commented 1 week ago

Looks like it was missing from the VM though, and installing it there maybe helps?

@skylarmt After installing libatomic1 in the VM, does it still segfault? It doesn't for me.

image