microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
163.87k stars 29.14k forks source link

Frequent crashes and general instability on Fedora Linux #221886

Open MaddyGuthridge opened 3 months ago

MaddyGuthridge commented 3 months ago

Does this issue occur when all extensions are disabled?: Yes

Version: 1.91.1 Commit: f1e16e1e6214d7c44d078b1f0607b2388f29d729 Date: 2024-07-09T22:08:12.169Z Electron: 29.4.0 ElectronBuildId: 9728852 Chromium: 122.0.6261.156 Node.js: 20.9.0 V8: 12.2.281.27-electron.0 OS: Linux x64 6.9.8-200.fc40.x86_64 (Fedora 40)

For the past few weeks, I've been experiencing huge amounts of instability and frequent crashes when using VS Code on Fedora 40. There are numerous issues I have experienced, which all started at the same time. I am not sure if they are related. All occur when starting VS Code and opening a project (from a terminal, this is code --verbose /path/to/project > code.log). The error occurs once every four or five launches.

All except for the last error can be reproduced with extensions disabled. Error log with extensions disabled: code.extension-errors.txt

Extensions with which I have experienced the extension errors:

Steps to Reproduce:

  1. Launch VS Code. Either from the command line, or from the application launcher.
  2. It will crash immediately, or a random extension will crash with the errors in the screenshot above.
shaquibimdad commented 3 months ago

I am having issues on a fresh fedora and fresh code installation no any extensions nothing

code --version
1.91.1
f1e16e1e6214d7c44d078b1f0607b2388f29d729
x64

[11209:0718/130614.767955:WARNING:bluez_dbus_manager.cc(248)] Floss manager not present, cannot set Floss enable/disable.
[main 2024-07-18T07:36:14.873Z] [File Watcher (node.js)] Request to start watching: /home/shaquibimdad/.config/Code/User (excludes: <none>, includes: <all>, filter: <none>, correlationId: <none>),/home/shaquibimdad/.config/Code/User/settings.json (excludes: <none>, includes: <all>, filter: <none>, correlationId: <none>)
[main 2024-07-18T07:36:14.891Z] Starting VS Code
[main 2024-07-18T07:36:14.891Z] from: /usr/share/code/resources/app
[main 2024-07-18T07:36:14.891Z] args: {
  _: [],
  diff: false,
  merge: false,
  add: false,
  goto: false,
  'new-window': false,
  'reuse-window': false,
  wait: false,
  help: false,
  'list-extensions': false,
  'show-versions': false,
  'pre-release': false,
  'update-extensions': false,
  version: false,
  verbose: true,
  status: false,
  'prof-startup': false,
  'no-cached-data': false,
  'prof-v8-extensions': false,
  'disable-extensions': false,
  'disable-lcd-text': false,
  'disable-gpu': false,
  'disable-chromium-sandbox': false,
  sandbox: false,
  telemetry: false,
  debugRenderer: false,
  'enable-smoke-test-driver': false,
  logExtensionHostCommunication: false,
  'skip-release-notes': false,
  'skip-welcome': false,
  'disable-telemetry': false,
  'disable-updates': false,
  'use-inmemory-secretstorage': false,
  'disable-workspace-trust': false,
  'disable-crash-reporter': false,
  'crash-reporter-id': 'c21f5430-2664-4abd-bb4e-8cff445418ab',
  'skip-add-to-recently-opened': false,
  'open-url': false,
  'file-write': false,
  'file-chmod': false,
  force: false,
  'do-not-sync': false,
  trace: false,
  'preserve-env': false,
  'force-user-env': false,
  'force-disable-user-env': false,
  'open-devtools': false,
  'disable-gpu-sandbox': false,
  '__enable-file-policy': false,
  'enable-coi': false,
  'no-proxy-server': false,
  'no-sandbox': false,
  nolazy: false,
  'force-renderer-accessibility': false,
  'ignore-certificate-errors': false,
  'allow-insecure-localhost': false,
  'disable-dev-shm-usage': false,
  'profile-temp': false,
  logsPath: '/home/shaquibimdad/.config/Code/logs/20240718T130614'
}
[main 2024-07-18T07:36:14.893Z] Resolving machine identifier...
[main 2024-07-18T07:36:14.893Z] Resolved machine identifier: bd1e18517e2eb0191cd0f2d1de92c789c570450e169312f509b14407ce276ad9
[main 2024-07-18T07:36:14.893Z] Main->SharedProcess#connect
[main 2024-07-18T07:36:14.897Z] [File Watcher (node.js)] Started watching: '/home/shaquibimdad/.config/Code/User'
[main 2024-07-18T07:36:14.898Z] StorageMainService: creating application storage
[main 2024-07-18T07:36:14.901Z] ElectronURLListener: waiting for window to be ready to handle URLs...
[main 2024-07-18T07:36:14.901Z] lifecycle (main): phase changed (value: 2)
[main 2024-07-18T07:36:14.901Z] windowsManager#open
[main 2024-07-18T07:36:14.901Z] windowsManager#open pathsToOpen [
  {
    backupPath: '/home/shaquibimdad/.config/Code/Backups/1721288122462',
    remoteAuthority: undefined
  }
]
[main 2024-07-18T07:36:14.901Z] windowsManager#doOpenEmpty {
  restore: true,
  remoteAuthority: undefined,
  filesToOpen: undefined,
  forceNewWindow: true
}
[main 2024-07-18T07:36:14.902Z] IPC Object URL: Registered new channel vscode:18643d32-c82f-4237-83f2-e1d87502ebb4.
[main 2024-07-18T07:36:14.902Z] window#validateWindowState: validating window state on 1 display(s) { mode: 1, x: 448, y: 230, width: 1024, height: 768 }
[main 2024-07-18T07:36:14.902Z] window#validateWindowState: single monitor working area { x: 0, y: 32, width: 1920, height: 1048 }
[main 2024-07-18T07:36:14.902Z] window#ctor: using window state { mode: 1, x: 448, y: 230, width: 1024, height: 768 }
[main 2024-07-18T07:36:14.978Z] window#load: attempt to load window (id: 1)
[main 2024-07-18T07:36:14.985Z] windowsManager#open used window count 1 (workspacesToOpen: 0, foldersToOpen: 0, emptyToRestore: 1, emptyToOpen: 0)
[main 2024-07-18T07:36:14.985Z] lifecycle (main): phase changed (value: 3)
[main 2024-07-18T07:36:14.985Z] resolveShellEnv(): skipped (VSCODE_CLI is set)
[main 2024-07-18T07:36:14.985Z] update#setState idle
[main 2024-07-18T07:36:15.010Z] [File Watcher (node.js)] ignoring a path for watching who's stat info failed to resolve: /home/shaquibimdad/.config/Code/User/settings.json (error: Error: ENOENT: no such file or directory, stat '/home/shaquibimdad/.config/Code/User/settings.json')
[11247:0718/130616.890667:WARNING:sandbox_linux.cc(418)] InitializeSandbox() called with multiple threads in process gpu-process.
[main 2024-07-18T07:36:16.924Z] resolveShellEnv(): skipped (VSCODE_CLI is set)
<--- Last few GCs --->

[1:0x2e3000568000]     2058 ms: Mark-Compact (reduce) 1.1 (3.7) -> 1.1 (2.4) MB, pooled: 0 MB, 3.11 / 0.00 ms  (average mu = 0.196, current mu = 0.011) last resort; GC in old space requested
[1:0x2e3000568000]     2059 ms: Mark-Compact (reduce) 1.1 (2.4) -> 1.1 (2.4) MB, pooled: 0 MB, 1.30 / 0.00 ms  (average mu = 0.140, current mu = 0.018) last resort; GC in old space requested

<--- JS stacktrace --->
[11266:0718/130617.052677:ERROR:v8_initializer.cc(799)] V8 javascript OOM (CALL_AND_RETRY_LAST).
[0718/130617.062531:ERROR:directory_reader_posix.cc(43)] opendir /home/shaquibimdad/.config/Code/Crashpad/attachments/ba6b2930-08ff-4709-aacf-3c9eb097827a: No such file or directory (2)
Renderer process crashed - see https://www.electronjs.org/docs/tutorial/application-debugging for potential debugging information.
[main 2024-07-18T07:36:17.376Z] CodeWindow: renderer process gone (reason: crashed, code: 132)
[main 2024-07-18T07:36:17.490Z] lifecycle (main): phase changed (value: 4)
[11209:0718/130619.855371:ERROR:browser_main_loop.cc(278)] GLib-GObject: ../gobject/gsignal.c:2685: instance '0x1ab000bf2540' has no handler with id '2847'
[main 2024-07-18T07:36:19.859Z] IPC Object URL: Removed channel vscode:18643d32-c82f-4237-83f2-e1d87502ebb4.
[main 2024-07-18T07:36:19.860Z] Lifecycle#window.on('closed') - window ID 1
[main 2024-07-18T07:36:19.860Z] Lifecycle#onWillShutdown.fire()
[main 2024-07-18T07:36:19.862Z] Lifecycle#onWillShutdown - begin 'instanceLockfile'
[main 2024-07-18T07:36:19.862Z] storageMainService#onWillShutdown()
[main 2024-07-18T07:36:19.862Z] Lifecycle#onWillShutdown - begin 'applicationStorage'
[main 2024-07-18T07:36:19.863Z] Lifecycle#onWillShutdown - begin 'extHostStarter'
[main 2024-07-18T07:36:19.863Z] Lifecycle#app.on(window-all-closed)
[main 2024-07-18T07:36:19.863Z] Lifecycle#app.on(before-quit)
[main 2024-07-18T07:36:19.863Z] Lifecycle#onBeforeShutdown.fire()
[main 2024-07-18T07:36:19.864Z] [WindowsStateHandler] onBeforeShutdown {
  lastActiveWindow: undefined,
  lastPluginDevelopmentHostWindow: undefined,
  openedWindows: []
}
[main 2024-07-18T07:36:19.864Z] Lifecycle#app.on(will-quit) - begin
[main 2024-07-18T07:36:19.864Z] Lifecycle#onWillShutdown - end 'extHostStarter'
[main 2024-07-18T07:36:19.865Z] Lifecycle#onWillShutdown - end 'instanceLockfile'
[main 2024-07-18T07:36:19.868Z] [File Watcher (node.js)] Request to stop watching: /home/shaquibimdad/.config/Code/User (excludes: <none>, includes: <all>, filter: <none>, correlationId: <none>),/home/shaquibimdad/.config/Code/User/settings.json (excludes: <none>, includes: <all>, filter: <none>, correlationId: <none>)
[main 2024-07-18T07:36:19.868Z] [File Watcher (node.js)] stopping file watcher (/home/shaquibimdad/.config/Code/User (excludes: <none>, includes: <all>, filter: <none>, correlationId: <none>))
[main 2024-07-18T07:36:19.869Z] [File Watcher (node.js)] stopping file watcher (/home/shaquibimdad/.config/Code/User/settings.json (excludes: <none>, includes: <all>, filter: <none>, correlationId: <none>))
[main 2024-07-18T07:36:19.869Z] StorageMainService: closed application storage
[main 2024-07-18T07:36:19.870Z] Lifecycle#onWillShutdown - end 'applicationStorage'
[main 2024-07-18T07:36:19.882Z] Lifecycle#app.on(will-quit) - after fireOnWillShutdown
[main 2024-07-18T07:36:19.882Z] Lifecycle#app.on(will-quit) - calling app.quit()```
MaddyGuthridge commented 3 months ago

Got a new error today:

$ code /path/to/folder

<--- Last few GCs --->

[87797:0x3ac0002e4000]       92 ms: Mark-Compact (reduce) 0.6 (3.2) -> 0.6 (2.2) MB, pooled: 0 MB, 0.87 / 0.00 ms  (average mu = 0.167, current mu = 0.021) last resort; GC in old space requested
[87797:0x3ac0002e4000]       92 ms: Mark-Compact (reduce) 0.6 (2.2) -> 0.6 (2.2) MB, pooled: 0 MB, 0.78 / 0.00 ms  (average mu = 0.096, current mu = 0.009) last resort; GC in old space requested

<--- JS stacktrace --->

#
# Fatal JavaScript out of memory: CALL_AND_RETRY_LAST
#
/usr/bin/code: line 62: 87797 Trace/breakpoint trap   (core dumped) ELECTRON_RUN_AS_NODE=1 "$ELECTRON" "$CLI" "$@"

My system has 64 GB of RAM, I am certain that I did not run out of memory.

innomatica commented 2 months ago

Got a new error today:

$ code /path/to/folder

<--- Last few GCs --->

[87797:0x3ac0002e4000]       92 ms: Mark-Compact (reduce) 0.6 (3.2) -> 0.6 (2.2) MB, pooled: 0 MB, 0.87 / 0.00 ms  (average mu = 0.167, current mu = 0.021) last resort; GC in old space requested
[87797:0x3ac0002e4000]       92 ms: Mark-Compact (reduce) 0.6 (2.2) -> 0.6 (2.2) MB, pooled: 0 MB, 0.78 / 0.00 ms  (average mu = 0.096, current mu = 0.009) last resort; GC in old space requested

<--- JS stacktrace --->

#
# Fatal JavaScript out of memory: CALL_AND_RETRY_LAST
#
/usr/bin/code: line 62: 87797 Trace/breakpoint trap   (core dumped) ELECTRON_RUN_AS_NODE=1 "$ELECTRON" "$CLI" "$@"

My system has 64 GB of RAM, I am certain that I did not run out of memory.

I have exactly the same error on my system with 32GB RAM. It happens each time I run it after the boot. Subsequent runs seem to be o.k.

MaddyGuthridge commented 2 months ago

In a (seemingly now-deleted) comment, someone suggested that the latest kernel version (6.9.12) had resolved the issues. Unfortunately, this has not been the case for me. I am still experiencing this issue quite frequently.

| maddy@yzma :: ~  
⋙   uname -a
Linux yzma 6.9.12-200.fc40.x86_64 #1 SMP PREEMPT_DYNAMIC Sat Jul 27 15:56:15 UTC 2024 x86_64 GNU/Linux
| maddy@yzma :: ~  
⋙   code --version
1.92.0
b1c0a14de1414fcdaa400695b4db1c0799bc3124
x64
| maddy@yzma :: ~  
⋙   code --verbose

<--- Last few GCs --->

[9587:0x2b8c002ec000]       46 ms: Mark-Compact (reduce) 0.5 (2.9) -> 0.5 (1.9) MB, pooled: 0 MB, 0.54 / 0.00 ms  (average mu = 0.501, current mu = 0.067) last resort; GC in old space requested
[9587:0x2b8c002ec000]       46 ms: Mark-Compact (reduce) 0.5 (1.9) -> 0.5 (1.9) MB, pooled: 0 MB, 0.58 / 0.00 ms  (average mu = 0.328, current mu = 0.010) last resort; GC in old space requested

<--- JS stacktrace --->

#
# Fatal JavaScript out of memory: CALL_AND_RETRY_LAST
#
----- Native stack trace -----

/usr/bin/code: line 62:  9587 Trace/breakpoint trap   (core dumped) ELECTRON_RUN_AS_NODE=1 "$ELECTRON" "$CLI" "$@"
MaddyGuthridge commented 2 months ago

Possibly related? #201546

MaddyGuthridge commented 2 months ago

Here is a crash dump created using these instructions.

code-crash.zip

datho7561 commented 2 months ago

Do we know for sure if this is Fedora specific? Maybe I'll spin up some VMs to try to replicate it on different Linuxes. This bug is getting pretty annoying, especially when developing VS Code extensions.

datho7561 commented 2 months ago

I made an Arch Linux VM, and so far I haven't been able to replicate the failure.

I'm still seeing the same weirdness of the window sometimes forcing itself fullscreen when I try to move the window by clicking on the titlebar.

Arch Linux is using the 6.10 Linux kernel, which is newer than my Fedora installation (6.9.12). I set Arch Linux up to run Gnome under Wayland. Arch Linux is using a slightly newer Gnome (46.4) than my Fedora installation (46.3.1).

I'm using the OSS build of VS Code, since that's what's available from the Arch Linux repo. It's reporting the same version number and commit hash. (1.92.0). I'll take a look into installing the official build to see if that makes a difference.

albertgasset commented 2 months ago

This could be related to this selinux/kernel bug affecting all chromium based apps: https://bugzilla.redhat.com/show_bug.cgi?id=2254434 In that case, it should work with SELinux set to permissive.

MaddyGuthridge commented 2 months ago

@albertgasset this seems like a plausible hypothesis -- I'll check my SELinux logs next time I'm booted into Fedora

MaddyGuthridge commented 2 months ago

Yep, looks like SELinux is blocking it:

| maddy@yzma :: ~  
⋙   sudo ausearch -m AVC,USER_AVC,SELINUX_ERR,USER_SELINUX_ERR -ts recent | tail
type=AVC msg=audit(1723444004.938:1511): avc:  denied  { execheap } for  pid=13566 comm="code" scontext=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 tcontext=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 tclass=process permissive=0
----
time->Mon Aug 12 16:26:44 2024
type=AVC msg=audit(1723444004.938:1512): avc:  denied  { execheap } for  pid=13566 comm="code" scontext=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 tcontext=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 tclass=process permissive=0
----
time->Mon Aug 12 16:26:45 2024
type=AVC msg=audit(1723444005.554:1513): avc:  denied  { execheap } for  pid=13566 comm="code" scontext=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 tcontext=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 tclass=process permissive=0
----
time->Mon Aug 12 16:26:45 2024
type=AVC msg=audit(1723444005.582:1514): avc:  denied  { execheap } for  pid=13566 comm="code" scontext=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 tcontext=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 tclass=process permissive=0

Setting SELINUX=permissive in /etc/selinux/config then rebooting appears to have resolved it for me, but I'd rather not go reducing the effectiveness security features on my system.

albertgasset commented 2 months ago

The upcoming update of the kernel for Fedora 40 (now in testing) includes a patch that fixes the selinux bug: https://koji.fedoraproject.org/koji/buildinfo?buildID=2532093

ttoommxx commented 2 months ago

Just updated to the latest kernel but the problem persists.. Any solution?? I even disabled SElinux but nothing at all.... reverting kernel is the only option at this point

datho7561 commented 2 months ago

I updated to the latest Fedora 40 kernel (6.10.6) and I haven't been able to reproduce the crash any more. I have SELinux set to enforcing.

@ttoommxx which kernel are you on? 6.10.6 is the one that is supposed to contain the fix

ttoommxx commented 2 months ago

I am on 6.10.6. Was working fine but it keeps crashing the Desktop Environment which is fairly destructive, as I am booted out and need to relogin. Any idea who to investigate the problem better?

Actually, it seems to be related to a problem with AMD gpus rather than VScode