Repository: vscode
Issue: Int3 / Trap Random Crashes
Labels: bug,upstream,freeze-slow-crash-leak,linux,upstream-issue-linked,chromium


Type: <b>Bug</b>

For a little while now, VSCode (Note that this seems to happen with lots of Electron apps as well) randomly crash.
It seems that the bug is random enough so it's very hard to get it on first try from the terminal - but then given that VSCode spawns lots of processes, it increases the chances for it to happen.

However, I was able to catch it from the main process. The crash occurs almost immediatelly:

```
> code .
<--- Last few GCs --->

[29775:0x454002d8000]      158 ms: Mark-Compact (reduce) 0.7 (2.9) -> 0.7 (1.9) MB, 2.36 / 0.00 ms  (average mu = 0.436, current mu = 0.062) last resort; GC in old space requested
[29775:0x454002d8000]      160 ms: Mark-Compact (reduce) 0.7 (1.9) -> 0.7 (1.9) MB, 1.91 / 0.00 ms  (average mu = 0.297, current mu = 0.022) last resort; GC in old space requested


<--- JS stacktrace --->


#
# Fatal JavaScript out of memory: CALL_AND_RETRY_LAST
#

/usr/bin/code: line 62: 29775 Trace/breakpoint trap   (core dumped) ELECTRON_RUN_AS_NODE=1 "$ELECTRON" "$CLI" "$@"
```

The interesting part is that every single of these crashes looks like this in `dmesg` (Some of them from other apps **all using Electron):

```
May 27 09:49:19 Lebleblem kernel: traps: rambox[8774] trap int3 ip:55c1aa6c0793 sp:7ffe10f9bb58 error:0 in rambox[55c1a53e9000+7ec0000]
May 27 09:51:32 Lebleblem kernel: traps: code[11599] trap int3 ip:559dd31ff406 sp:7ffc7a7bea90 error:0 in code[559dce34c000+7a5f000]
May 27 10:30:06 Lebleblem kernel: traps: code[29775] trap int3 ip:5584db8f8743 sp:7ffe14eaa278 error:0 in code[5584d6ae0000+7892000]
May 27 10:40:26 Lebleblem kernel: traps: rambox[33173] trap int3 ip:5635c80026b6 sp:7fffb8e7d2d0 error:0 in rambox[5635c1be0000+7ec0000]
May 27 10:40:33 Lebleblem kernel: traps: rambox[33376] trap int3 ip:5602810aa6b6 sp:7ffd16909810 error:0 in rambox[56027ac88000+7ec0000]
May 27 10:40:39 Lebleblem kernel: traps: rambox[33529] trap int3 ip:5636d00fd6b6 sp:7ffd25456b70 error:0 in rambox[5636c9cdb000+7ec0000]
```

I happen to be using a Linux custom kernel - so to rule out this possibility I've tried many other mainstream kernels (6.8 branch, 6.9 branch) and the crash seem to occur at different frequencies - but still occurs.
It occured to me that it could be ZRam and tried disabling it - still crashing.
I thought this could be related to hardware - so I've disabled Hardware Acceleration in the runtime settings, and interestingly it occurs at a lower frequency.

I've also `Memtest86+` my entire RAM agressivelly twice - all good.

VS Code version: Code 1.87.2 (863d2581ecda6849923a2118d93a088b0745d9d6, 2024-03-08T15:14:59.643Z)
OS version: Linux x64 6.9.1-200.fc40.x86_64
Modes:

<details>
<summary>System Info</summary>

|Item|Value|
|---|---|
|CPUs|Intel(R) Core(TM) Ultra 7 155H (21 x 1706)|
|GPU Status|2d_canvas: enabled<br>canvas_oop_rasterization: disabled_off<br>direct_rendering_display_compositor: disabled_off_ok<br>gpu_compositing: enabled<br>multiple_raster_threads: enabled_on<br>opengl: enabled_on<br>rasterization: enabled<br>raw_draw: disabled_off_ok<br>skia_graphite: disabled_off<br>video_decode: enabled<br>video_encode: disabled_software<br>vulkan: disabled_off<br>webgl: enabled<br>webgl2: enabled<br>webgpu: disabled_off|
|Load (avg)|2, 3, 4|
|Memory (System)|15.20GB (8.52GB free)|
|Process Argv|.|
|Screen Reader|no|
|VM|0%|
|DESKTOP_SESSION|plasma|
|XDG_CURRENT_DESKTOP|KDE|
|XDG_SESSION_DESKTOP|KDE|
|XDG_SESSION_TYPE|wayland|
</details><details><summary>Extensions (16)</summary>

Extension|Author (truncated)|Version
---|---|---
better-comments|aar|3.0.2
markdown-mermaid|bie|1.23.0
mermaid-markdown-syntax-highlighting|bpr|1.6.4
file-icons|fil|1.1.0
vscode-graphql-syntax|Gra|1.3.6
elixir-ls|Jak|0.21.3
dotenv|mik|1.0.1
hexeditor|ms-|1.10.0
vscode-typescript-next|ms-|5.5.20240505
vsliveshare|ms-|1.0.5918
material-icon-theme|PKi|5.3.0
vscode-uppercase|rui|1.0.1
code-spell-checker|str|3.0.1
json-schema-validator|tbe|0.1.0
markdown-pdf|yza|1.5.0
material-theme|zhu|3.17.2

(1 theme extensions excluded)

</details>
<!-- generated by issue reporter -->