vscode: Insiders on macOS ARM64: Extension Host crashes (`SIGILL`, `EFAULT`, `EPIPE`)

Issue Type: Bug

I haven’t seen this reported anywhere, so here goes.

Using the latest insiders version on macOS, I noticed that there are stability issues with extensions.

After some time running vscode, the extension host either crashes and needs to be restarted, or the code actions that trigger on saving a document start hanging.

I noticed that in the Developer Tools it frequently logs messages like:

Uncaught Exception:  Error: read EFAULT
    at Pipe.onStreamRead (internal/stream_base_commons.js:205:27)
t.log @ console.ts:137
Screenshot 2020-12-25 at 10 14 32

The EFAULT exceptions might be triggering this behavior.

This also hangs and spins forever: Screenshot 2020-12-25 at 10 10 39

If I cancel it, then run Developer: Restart Extension Host it will then save properly.

(It’s possible one of my extensions might be interfering as well, as I have a ton of them enabled - but I don’t remember seeing this on Stable VSCode with Rosetta.)

VS Code version: Code - Insiders 1.53.0-insider (4a875e23d20b64504a818834f3fa4c40adb8d480, 2020-12-21T12:34:09.548Z) OS version: Darwin arm64 20.2.0

System Info
Item Value
CPUs undefined
GPU Status 2d_canvas: enabled
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
protected_video_decode: unavailable_off
rasterization: enabled
skia_renderer: disabled_off_ok
video_decode: enabled
webgl: enabled
webgl2: enabled
Load (avg) 2, 3, 3
Memory (System) 8.00GB (0.17GB free)
Process Argv –crash-reporter-id ea63df4b-e690-4545-96f3-6944dca865ad
Screen Reader no
VM 0%
Extensions (58)
Extension Author (truncated) Version
better-comments aar 2.1.0
vscode-base64 ada 0.1.0
vsc-rename-files alf 2.1.0
ng-template Ang 0.1100.2
vscode-color ans 0.4.5
vscode-apollo apo 1.18.0
vscode-zipfs arc 2.2.2
folder-source-actions bie 0.2.0
markdown-preview-github-styles bie 0.1.6
path-intellisense chr 2.3.0
react-toolkit Cod 1.1.23
angular-schematics cyr 4.7.0
vscode-eslint dba 2.1.14
emulate Die 1.4.0
es7-react-js-snippets dsz 3.1.0
gitlens eam 11.1.0
tsl-problem-matcher eam 0.3.1
prettier-vscode esb 5.8.0
vscode-todo-plus fab 4.18.0
flow-for-vscode flo 1.5.0
vscode-yarn gam 1.7.1
beautify Hoo 1.5.0
vscode-edit-csv jan 0.5.3
Angular2 joh 11.0.0
vscode-peacock joh 3.9.1
chat kar 0.35.0
graphql-for-vscode kum 1.15.3
vscode-wsl-workspacefolder lfu 1.1.2
ftp-sync luk 0.3.9
auto-barrel mik 1.7.1
dotenv mik 1.0.1
mongodb-vscode mon 0.3.0
vscode-csscomb mrm 5.3.2
vscode-docker ms- 1.9.0
vscode-edge-devtools ms- 1.1.1
remote-wsl ms- 0.52.0
vscode-js-profile-flame ms- 0.0.13
vsliveshare ms- 1.0.3375
vsliveshare-audio ms- 0.1.91
vsliveshare-pack ms- 0.4.0
debugger-for-chrome msj 4.12.11
vscode-react-native msj 1.2.0
angular2-inline nat 0.0.17
vscode-ios-common-files Ort 1.0.5
vscode-react-native-storybooks Ort 2.7.1
format-code-action roh 0.0.1
vscode-coverage-gutters rya 2.6.0
vscode-hexdump sle 1.8.1
move-ts str 1.12.0
theshukran-react-utils the 1.0.2
gitflow vec 1.2.1
es-quotes vil 0.2.6
vscodeintellicode Vis 1.2.10
vscode-wakatime Wak 4.0.10
vscode-html-pug-convertor way 0.1.1
vscode-ruby win 0.27.0
code-template-tool yua 0.6.2
sort-js-object-keys zen 1.0.6

(2 theme extensions excluded)

A/B Experiments
vsliv695:30137379
vsins829:30139715
vsliv368:30146709
vsreu685:30147344
openlogontheside:30221882
python763:30178808
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
python504:30227505
vswsl492:30208929
wsl2promptcf:30219163
vstry914:30230485
pythonvsdeb440:30224570
unusedpromptcf:30219165
folderexplorercf:30219167
openfilemenucf:30219169
pythonvsded773:30223139
core-portspanel:30233467

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 8
  • Comments: 89 (25 by maintainers)

Most upvoted comments

Lately I have seen a crash of the extension host on macOS 11.x ARM almost daily.

@vassudanagunta @huming2207 there should be no wasm related crashes with latest insiders, this issue is mainly tracking a crash under memory pressure.

Thanks for following-up on the issue!

Most importantly, the slowdowns related to executing the git binary no longer exist. Not sure if the patch in libuv/libuv#3064 was incorporated into the Electron fork used by VSCode or macOS 11.2 just fixed that as well.

Yup the fix has been backported to our fork for early testing, the OS update has nothing to do with it.

Created https://github.com/microsoft/vscode/issues/115646, please follow the issue for updates.

Thanks @andreialecu for investigating the issue, I am adding some more info on whats known so far:

History

With apple arm64 memory protection is enabled by default for all apps, which means a memory region cannot have rwx permission https://developer.apple.com/documentation/apple_silicon/porting_just-in-time_compilers_to_apple_silicon. But instead using pthread_jit_write_protect_np syscall a thread can switch between write and executable permission for a memory region. This is exactly what v8 did for the webassembly code path in https://chromium-review.googlesource.com/c/v8/v8/+/2378307. This patch landed in chromium 87.0.4265.0 and along with app being signed with entitlement com.apple.security.cs.allow-jit , an app will load wasm modules perfectly fine.

Whats affected Now:

Extension host process in vscode when loading wasm modules from an extension crashes. So any extension that loads wasm can be a cause: builtin js debugger, bracket pair colorizer 2 etc

Why:

The extension host process is currently forked from the chromium renderer process, so it has the same entitlement as the parent process. Also the chromium render process is able to load wasm without issues, vscode workbench uses oniguruma wasm module which is loaded in the render process.

So why only extension host ? Pending investigation. Minimal repro https://gist.github.com/deepak1556/a6d791b204978aeed549347b6c55d124

Since there are other crashes originally reported in this issue, I will split this out into separate issue to avoid confusion.

I can replicate this with all extensions disabled by starting js debugger.

macOS 11.2 production release + VSCode Insiders:

Version: 1.53.0-insider
Commit: 861a88ebadb4335df92251faf6420b598440e082
Date: 2021-01-29T21:59:10.149Z (2 days ago)
Electron: 11.2.1
Chrome: 87.0.4280.141
Node.js: 12.18.3
V8: 8.7.220.31-electron.0
OS: Darwin arm64 20.3.0
Screenshot 2021-02-01 at 22 58 06

I would paste the error text but it’s probably not relevant. (note that the error is slightly different than the one in the nodejs issue tracker)

@purge see: https://github.com/microsoft/vscode/issues/113410#issuecomment-754867902

The command I was using was: code-insiders --crash-reporter-directory ~/vscode-crash ..

I haven’t personally seen any SIGILLs in a long time, but if they happen frequently for you, it would likely help a lot if you can attach the crash dumps.

@deepak1556 Yes I agree. I think this is off-topic as it’s related to the permission issue https://github.com/nodejs/node/issues/37061 only.

Try --js-flags=–noexpose_wasm. It can start without warning on VSCode insider + macOS 11.1

The warning disappeared, but the extension host reports the same crash as in the screenshot I attached earlier.

Oh damn… Then I’d better stay at macOS 11.1 for now for my M1 mac…

Try --js-flags=–noexpose_wasm. It can start without warning on VSCode insider + macOS 11.1

The warning disappeared, but the extension host reports the same crash as in the screenshot I attached earlier.

If the crash continues, can you start the app with --crash-reporter-directory <some-absolute-path>, crash dumps will be generated in that location, please attach it here. Thanks!