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

app-editors/vscode: Crashes when loading non-builtin extensions if built with Electron 30.X #372

Closed
Imred-Gemu opened this issue Sep 5, 2024 · 19 comments
Labels
bug Something isn't working

Comments

@Imred-Gemu
Copy link

After updating to app-editors/vscode-1.92.2, I am unable to open Code-OSS if any third party extensions are installed before starting it, and attempting to install any into Code-OSS when it has none causes it to crash before successfully installing anything. In the latter case, it will start when opened again, but will still have no extensions. I can however uninstall extensions using the command line flags, which can be used to get an install running if it already has extensions installed without directly modifying its files. app-editors/vscodium is also using Code 1.92.2, and Electron 30.X (though it is a different minor version) and does not have this issues, so I believe this is unique either to my Code-OSS build, or possibly my Electron build. As this new versions brought a major version jump in Electron, I suspected that was related and tried a few builds:

Code 1.92.2 and 1.91.1 on Electron 30.4.0: Unable to install or load extensions.

Code 1.92.2 on Electron 29.4.6: Failed to build, Electron's Node crashes due to a "trace breakpoint" during the long running and non-verbose phase of the compile.

Code 1.91.1 on Electron 29.4.6: Builds fine, can load and install extensions fine. This is the build I'm using for now as it is at least functional, but this is not ideal as it's outdated enough that it has been dropped from the overlay.

When crashing from installing or loading extensions, even when run using code-oss --wait --verbose, I do not see any output that looks relevant to why the editor is crashing. I'm unsure of what further steps to take to debug this issue.

Use flags from the involved packages:

dev-util/electron-29.4.6::pf4public was built with the following:
USE="X bluetooth clang cups custom-cflags optimize-thinlto optimize-webui pulseaudio screencast system-harfbuzz system-icu system-libevent system-libusb system-openh264 system-openjpeg system-png system-zstd thinlto ungoogled vaapi -debug -dev-dependencies -gtk4 -hangouts -hevc -kerberos -libcxx -nvidia -pax-kernel -pgo -proprietary-codecs (-selinux) -system-abseil-cpp -system-av1 -system-brotli -system-crc32c -system-double-conversion -system-ffmpeg -system-jsoncpp -system-libvpx -system-re2 -system-snappy -system-woff2 -wayland" ABI_X86="(64)" L10N="-af -am -ar -bg -bn -ca -cs -da -de -el -en-GB -es -es-419 -et -fa -fi -fil -fr -gu -he -hi -hr -hu -id -it -ja -kn -ko -lt -lv -ml -mr -ms -nb -nl -pl -pt-BR -pt-PT -ro -ru -sk -sl -sr -sv -sw -ta -te -th -tr -uk -ur -vi -zh-CN -zh-TW"
CFLAGS="-O3 -pipe -fomit-frame-pointer -march=alderlake -mno-cldemote -mno-kl -mno-sgx -mno-widekl -mshstk -Wno-unknown-warning-option -Wno-builtin-macro-redefined"
CXXFLAGS="-O3 -pipe -fomit-frame-pointer -march=alderlake -mno-cldemote -mno-kl -mno-sgx -mno-widekl -mshstk -Wno-unknown-warning-option -Wno-builtin-macro-redefined"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,-z,pack-relative-relocs -Wl,--thinlto-jobs=20"


dev-util/electron-30.4.0::pf4public was built with the following:
USE="X bluetooth clang cups custom-cflags optimize-thinlto optimize-webui pulseaudio screencast system-harfbuzz system-icu system-libevent system-libusb system-openh264 system-openjpeg system-png system-zstd thinlto ungoogled vaapi -debug -dev-dependencies -gtk4 -hangouts -hevc -kerberos -libcxx -nvidia -pax-kernel -pgo -proprietary-codecs (-selinux) -system-abseil-cpp -system-av1 -system-brotli -system-crc32c -system-double-conversion -system-ffmpeg -system-jsoncpp -system-libvpx -system-re2 -system-snappy -system-woff2 -wayland" ABI_X86="(64)" L10N="-af -am -ar -bg -bn -ca -cs -da -de -el -en-GB -es -es-419 -et -fa -fi -fil -fr -gu -he -hi -hr -hu -id -it -ja -kn -ko -lt -lv -ml -mr -ms -nb -nl -pl -pt-BR -pt-PT -ro -ru -sk -sl -sr -sv -sw -ta -te -th -tr -uk -ur -vi -zh-CN -zh-TW"
CFLAGS="-O3 -pipe -fomit-frame-pointer -march=alderlake -mno-cldemote -mno-kl -mno-sgx -mno-widekl -mshstk -Wno-unknown-warning-option -Wno-builtin-macro-redefined"
CXXFLAGS="-O3 -pipe -fomit-frame-pointer -march=alderlake -mno-cldemote -mno-kl -mno-sgx -mno-widekl -mshstk -Wno-unknown-warning-option -Wno-builtin-macro-redefined"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,-z,pack-relative-relocs -Wl,--thinlto-jobs=20"


app-editors/vscode-1.91.1::pf4public was built with the following:
USE="badge-providers openvsx substitute-urls temp-fix -api-proposals -build-online -electron-27 -electron-28 -electron-30 -electron-31 -reh -reh-web" ABI_X86="(64)"
CFLAGS="-O3 -pipe -fomit-frame-pointer -march=alderlake -mabm -mno-cldemote -mno-kl -mno-sgx -mno-widekl -mshstk --param=l1-cache-line-size=64 --param=l1-cache-size=32 --param=l2-cache-size=24576 -I/usr/include/electron-29/node"
CXXFLAGS="-O3 -pipe -fomit-frame-pointer -march=alderlake -mabm -mno-cldemote -mno-kl -mno-sgx -mno-widekl -mshstk --param=l1-cache-line-size=64 --param=l1-cache-size=32 --param=l2-cache-size=24576 -DNODE_API_EXPERIMENTAL_NOGC_ENV_OPT_OUT"


[ebuild     U  ] app-editors/vscode-1.92.2::pf4public [1.91.1::pf4public] USE="badge-providers openvsx substitute-urls temp-fix -api-proposals -build-online -electron-27 -electron-28 -electron-29% -electron-31 -electron-32% -reh -reh-web (-electron-30%)" 0 KiB
@Imred-Gemu Imred-Gemu added the bug Something isn't working label Sep 5, 2024
@PF4Public
Copy link
Owner

Could it be a problem with openvsx?

@nethershaw
Copy link

Reproducible without USE=openvsx.

@PF4Public
Copy link
Owner

Is it a specific extension that makes it crash or just any of them?

@nethershaw
Copy link

Simply looking at any randomly chosen extension in vscode by selecting it in the extensions library, even if it is not installed (even if there are no extensions installed at all), is enough to cause the crash.

@PF4Public
Copy link
Owner

PF4Public commented Sep 27, 2024

Any messages in dmesg? Any logfiles? Have you tried any later electron version?

image

@nethershaw
Copy link

No, no, and yes.

@Imred-Gemu
Copy link
Author

My apologies, I have been really busy for a few weeks. Disabling the openvsx flag does not fix the issue, and @nethershaw is correct that even opening the page to view an extension leads to a crash after a delay. Some parts of the page load, others are still loading and then the window just suddenly closes. This is also the case if extensions are already installed (before updating or installed via the CLI options). The editor opens for a while, then after a delay it crashes. There is no new output in dmesg. Do you mean logs from ~/.config/Code\ -\ OSS/logs/, console output from the editor, both, or some other logs? Which log files would be most useful, or would you rather I send all of it? I have not tested a newer version of electron, I only have 29 and 30 installed, I will need to compile a newer versions tonight to test this.

@PF4Public
Copy link
Owner

PF4Public commented Oct 1, 2024

I think, it might be an old Chromium bug (#318). Please try rebuilding your existing electron as suggested in this comment: #318 (comment). Essentially you need to disable GLIBCXX_ASSERTIONS.

@Imred-Gemu
Copy link
Author

I am unfortunately unable to test this, Code 1.93.1 fails to compile on Electron 30 with or without the flags recommended in the linked comment, failing with the "trace breakpoint" error like 1.92.2 does on Electron 29. I can try a newer Electron version tonight.

@PF4Public
Copy link
Owner

You need to rebuild electron with that flag, not vscode

@Imred-Gemu
Copy link
Author

Correct, I built Electron 30 with that flag, and the new Electron build failed to build Code 1.93.1 with the "trace breakpoint" error. I then rebuilt Electron 30 again without that flag, and it is still failing to build Code 1.93.1 with the same error.

@PF4Public
Copy link
Owner

with the "trace breakpoint" error

This issue appears often and I don't have a solution for it (so far). Just try again and again.

@Imred-Gemu
Copy link
Author

I have a script to do that, as I often have the Code build fail due to OOM errors in Electron, and haven't found a solution to that other than repeating the build until it succeeds. I ran this a few nights ago, specifically building Code 1.93.1 with the Electron 30 build with the flag set. It failed all night long, and when I got back to it and let it fail once more before stopping it to see the trace breakpoint error. I then rebuilt Electron 30 without the flag set and tried compiling Code again, but got the same trace breakpoint error. Last night I built Electron 31, and rebuilt Code using that. After a few rounds of OOM errors, it eventually built it successfully, but this new Code build still crashes when rendering the detail page for any extension. I suppose the next reasonable step is to build Electron 31 with the flag set, and seeing if Code built with that fixes the issue.

@PF4Public
Copy link
Owner

I suppose the next reasonable step is to build Electron 31 with the flag set

Of course! The issue persists as it doesn't bother Google enough to fix it.

@nethershaw
Copy link

Rebuilt vscode (only one failed attempt due to "trace breakpoint") after rebuilding electron-30 as instructed. No change in behavior.

@Imred-Gemu
Copy link
Author

Finished a build with Code 1.93.1 on Electron 31.7.0 with the flag set. It built successfully and it appears to be able to render extensions normally, both when viewing them in the marketplace and when they are already installed. I'd like to build both again tonight to see if this is stable, or if I just got a lucky build.

@PF4Public
Copy link
Owner

@nethershaw Your issue might be a separate one then. Like #380 maybe.

@Imred-Gemu
Copy link
Author

I successfully rebuilt both Electron 31.7.0 and then Code 1.93.1 and the new build is also working correctly. My conclusion is that for whatever reason, Code 1.93.x requires Electron 31+ with my configuration, and to fix the issue with extensions not working requires Electron to be built with the following configuration changes:

$ cat /etc/portage/env/glibcxx-assertions 
CXXFLAGS="${CXXFLAGS} -U_GLIBCXX_ASSERTIONS"

$ cat /etc/portage/package.env/electron-code-extension-fix
dev-util/electron glibcxx-assertions

@PF4Public
Copy link
Owner

I'll call it "resolved" then :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants