Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node unconditionally uses AVX512 instructions (illegal instruction starting Extension Host agent) #214630

Open
mgaudet opened this issue Jun 7, 2024 · 4 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug electron-29-update extension-host Extension host issues upstream Issue identified as 'upstream' component related (exists outside of VS Code) upstream-issue-linked This is an upstream issue that has been reported upstream

Comments

@mgaudet
Copy link

mgaudet commented Jun 7, 2024

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

  • VS Code Version:
    Seeing this both on release and on insiders:

Release:

Version: 1.90.0 (Universal)
Commit: 89de5a8

Inisders:

Version: 1.91.0-insider (Universal)
Commit: 6facfe2

  • OS Version: Host is macOS, Remote system is Ubuntu 24

Steps to Reproduce:

  1. Use Remote Extension to open window on Ubuntu 24, on a AMD machine with AVX-512 disabled as a boot parameter

Result: Extension host crashes immediately:

[10:51:37.003] [server] [10:51:36] Extension host agent started.
[10:51:37.032] [server] [10:51:37] [<unknown>][d99d6c11][ManagementConnection] New connection established.
[10:51:37.039] [server] [10:51:37] [<unknown>][0be45ac4][ExtensionHostConnection] New connection established.
[10:51:37.081] [server] [10:51:37] [<unknown>][0be45ac4][ExtensionHostConnection] <3493> Launched Extension Host Process.
[10:51:37.874] [server] Illegal instruction (core dumped)

The node backtrace here is:

(gdb) bt 
#0  0x0000000001f9f093 in base64_stream_encode_avx512 ()
#1  0x0000000001f92614 in base64_encode ()
#2  0x0000000000dc2965 in node::StringBytes::Encode(v8::Isolate*, char const*, unsigned long, node::encoding, v8::Local<v8::Value>*) [clone .part.0] ()
#3  0x0000000000c778bf in void node::Buffer::(anonymous namespace)::StringSlice<(node::encoding)2>(v8::FunctionCallbackInfo<v8::Value> const&) ()
#4  0x0000000000f328df in v8::internal::FunctionCallbackArguments::Call(v8::internal::CallHandlerInfo) ()
#5  0x0000000000f3314d in v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<false>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::internal::Handle<v8::internal::Object>, unsigned long*, int) ()
#6  0x0000000000f33615 in v8::internal::Builtin_HandleApiCall(int, unsigned long*, v8::internal::Isolate*) ()
#7  0x000000000193cdf6 in Builtins_CEntry_Return1_ArgvOnStack_BuiltinExit ()
#8  0x00000000018aed1c in Builtins_InterpreterEntryTrampoline ()
#9  0x00000e00281804e9 in ?? ()
#10 0x00003d3db84f8191 in ?? ()
#11 0x0000000700000000 in ?? ()
#12 0x00000e00281805b9 in ?? ()
#13 0x00003e25859eefa9 in ?? ()
#14 0x0000000000000000 in ?? ()

This machine is AMD Ryzen Threadripper PRO 7975WX, but for compatibility with https://pernos.co/, I've explicitly disabled AVX-512 by adding clearcpuid=304 to GRUB_CMDLINE_LINUX_DEFAULT in /etc/default/grub

As you can see, AVX512 isn't listed in the /proc/cpuinfo:

flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good amd_lbr_v2 nopl nonstop_tsc cpuid extd_apicid aperfmperf rapl pni pclmulqdq monitor ssse3 fma cx16 pcid sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb cat_l3 cdp_l3 hw_pstate ssbd mba perfmon_v2 ibrs ibpb stibp ibrs_enhanced vmmcall fsgsbase bmi1 avx2 smep bmi2 erms invpcid cqm rdt_a rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local clzero irperf xsaveerptr rdpru wbnoinvd amd_ppin cppc arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif x2avic v_spec_ctrl vnmi umip pku ospke rdpid overflow_recov succor smca fsrm flush_l1d debug_swap
bugs		: sysret_ss_attrs spectre_v1 spectre_v2 spec_store_bypass srso

This bug is similar to #180843

@mgaudet mgaudet changed the title Node unconditionally uses AVX512 instructions (illegal instruction Node unconditionally uses AVX512 instructions (illegal instruction starting Extension Host agent) Jun 7, 2024
@mgaudet
Copy link
Author

mgaudet commented Jun 7, 2024

Note: This is a regression as previous versions of vscode didn't do this, as I was using this configuration yesterday.

@alexdima alexdima added remote-connection Issues about the remote connection extension-host Extension host issues bug Issue identified by VS Code Team member as probable bug and removed remote-connection Issues about the remote connection labels Jun 11, 2024
@mgaudet
Copy link
Author

mgaudet commented Jun 11, 2024

I suspect the regressing commit will be nodejs/node#52428

@mgaudet
Copy link
Author

mgaudet commented Jun 12, 2024

Bisected down to nodejs/node@f45bb80 will open a Node bug.

@alexdima alexdima assigned deepak1556 and unassigned alexdima Jun 12, 2024
@deepak1556 deepak1556 added upstream Issue identified as 'upstream' component related (exists outside of VS Code) upstream-issue-linked This is an upstream issue that has been reported upstream electron-29-update labels Jun 12, 2024
@deepak1556
Copy link
Collaborator

Thanks for tracking down the root cause. As a targeted fix I can backport aklomp/base64#143 when it is merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug electron-29-update extension-host Extension host issues upstream Issue identified as 'upstream' component related (exists outside of VS Code) upstream-issue-linked This is an upstream issue that has been reported upstream
Projects
None yet
Development

No branches or pull requests

3 participants