PF4Public / gentoo-overlay

Personal Gentoo overlay
78 stars 17 forks source link

www-client/ungoogled-chromium:122.0.6261.111 (and at least 121 too) crash at start with “Assertion 'this->_M_is_engaged()' failed.” #318

Closed waptaff closed 6 months ago

waptaff commented 6 months ago

Compilation is a success.

Lately, when starting it, the last session's previous windows appear then immediately vanish, I get this error:

/usr/lib/gcc/x86_64-pc-linux-gnu/13/include/g++-v13/optional:479: _Tp &std::_Optional_base_impl<content::DocumentAssociatedData, std::_Optional_base<content::DocumentAssociatedData>>::_M_get() [_Tp = content::DocumentAssociatedData, _Dp = std::_Optional_base<content::DocumentAssociatedData>]: Assertion 'this->_M_is_engaged()' failed.

My USE flags: X bluetooth clang cups official optimize-webui proprietary-codecs selinux system-crc32c system-double-conversion system-harfbuzz system-icu system-libevent system-libusb system-openh264 system-openjpeg system-png system-snappy system-woff2 system-zstd vaapi -cfi -convert-dict -cromite -custom-cflags -debug -enable-driver -gtk4 -hangouts -headless -hevc -kerberos -libcxx -nvidia -optimize-thinlto -override-data-dir -pax-kernel -pgo -pulseaudio -qt5 -qt6 -screencast -system-abseil-cpp -system-av1 -system-brotli -system-ffmpeg -system-jsoncpp -system-libvpx -system-re2 -thinlto -wayland -widevine

My CHROMIUM_FLAGS: --enable-accelerated-video-decode --enable-features=VaapiVideoDecoder,PlatformHEVCDecoderSupport --disable-features=UseChromeOSDirectVideoDecoder --alsa-output-device=chromiumvolume

Here is a copy of a gdb backtrace — alas, debugging symbols are minimal, it already takes 8-10 hours to compile the application on my system.

When I try with a fresh user profile (chromium --user-data-dir=/tmp/garbage), application does not crash immediately, but installing extensions (tried uBlock and CheerpJ) and then restarting chromium makes it crash with the same error.

Using =sys-devel/gcc-13.2.1_p20240113-r1, clang/llvm 17.0.6.

The matching ungoogled-chromium-bin versions don't crash.

Any clue or method to dig deeper into the error would be appreciated as I'd like to avoid playing an almost never-ending blind whack-a-mole game with the USE flags.

Thank you for your time,

PF4Public commented 6 months ago

Did you build with ccache?

waptaff commented 6 months ago

Did you build with ccache?

No, dev-util/ccache is not even installed.

PF4Public commented 6 months ago

@waptaff Is your gcc hardened?

waptaff commented 6 months ago

Yes it is, gcc has the hardened USE flag. Should I try removing the flag?

Or maybe try adding -U_GLIBCXX_ASSERTIONS to my ungoogled-chromium CXXFLAGS?

PF4Public commented 6 months ago

gcc has the hardened USE flag

That could explain the failure. It looks like a reappearance of https://chromium-review.googlesource.com/c/chromium/src/+/5014405. Although the fix had been merged, the code seems to be changed since then, perhaps the bug returned or they forgot to fix an edge-case with extensions.

If you intentionally enabled hardened for gcc, then your options are:

waptaff commented 6 months ago

@PF4Public Thank you for your analysis and proposed workarounds.

I will try disabling assertions first, as I'd prefer to avoid the libcxx rabbit hole.

I'll post results once I have them; that should be in about 24 hours.

waptaff commented 6 months ago

I confirm that adding -U_GLIBCXX_ASSERTIONS to ungoogled-chromium CXXFLAGS fixes the crashes at start.

Thank you for pointing me to the right direction, your hunch around gcc's hardened flag saved me lots of frustration.

PF4Public commented 6 months ago

You did a great job on eliminating possibilities in your original report, I had to examine the remaining ones :)

Have you attempted installing extensions? Is it completely solved then?

waptaff commented 6 months ago

It is completely solved as far as I can tell. My day-to-day setup which has about twenty-five extension doesn't crash anymore. All scenarios that caused a crash at startup don't do anymore.

PF4Public commented 6 months ago

Wonderful

r7l commented 5 months ago

Just want to say thanks. Had a smiliar issue and adding -U_GLIBCXX_ASSERTIONS helped me as well.

mrusme commented 5 months ago

I, as well, use the Gentoo hardened profile. I have created the following file:

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

And I have adjusted the following file:

# cat /etc/portage/package.env
www-client/ungoogled-chromium glibcxx-assertions

I can confirm that building the ungoogled-chromium package that way helps with the crashes. However, I still get the Aw, Snap! page in Chromium more often than not:

screenshot_2024-04-14-090457

The only output that I can see on the command line is:

[30232:30245:0414/090021.333911:ERROR:object_proxy.cc(576)] Failed to call method: org.freedesktop.DBus.Properties.Get: object_path= /org/freedesktop/portal/desktop: org.freedesktop.DBus.Error.InvalidArgs: No such interface “org.freedesktop.portal.FileChooser”
[30232:30245:0414/090021.333951:ERROR:select_file_dialog_linux_portal.cc(286)] Failed to read portal version property
[30232:30232:0414/090021.343564:ERROR:policy_logger.cc(157)] :components/enterprise/browser/controller/chrome_browser_cloud_management_controller.cc(161) Cloud management controller initialization aborted as CBCM is not enabled. Please use the `--enable-chrome-browser-cloud-management` command line flag to enable it if you are not using the official Google Chrome build.
[30232:30243:0414/090021.989895:ERROR:ev_root_ca_metadata.cc(162)] Failed to decode OID: 0

This didn't happen on a different machine on which I also have the hardened profile. This is a new installation on a new machine.

thubble commented 5 months ago

@mrusme Are you using version 123? That looks like https://github.com/PF4Public/gentoo-overlay/issues/333. I'm getting the same error and I'm not using the hardened profile

mrusme commented 5 months ago

@thubble Indeed, I'm using 123.0.6312.122_p1 with the flags listen in https://github.com/ungoogled-software/ungoogled-chromium/issues/2802 which appear to be relatively similar to yours.

southern-tools commented 4 months ago

Non hardened Gentoo here, @mrusme solution solved it also for me.

PF4Public commented 4 months ago

@southern-tools Thanks for confirming!

mrusme commented 4 months ago

My emerge build finished and I can as well confirm that the spontaneous tab crashing is gone.

mrusme commented 3 months ago

Updated to Chromium 126.0.6478.36 and we're back again:

[68636.856069] ThreadPoolForeg[20819]: segfault at 0 ip 0000000000000000 sp 00007f1a9fdff008 error 14 likely on CPU 4 (core 2, socket 0)
[68636.856082] Code: Unable to access opcode bytes at 0xffffffffffffffd6.

Aw snap! :-)

PS: The changes described here are still in place.

PF4Public commented 3 months ago

@mrusme What are your USE flags? I did a preliminary build and it worked fine, that's why I made it into testing.

mrusme commented 3 months ago

@PF4Public

equery u ungoogled-chromium
[ Legend : U - final flag setting for installation]
[        : I - package is installed with flag     ]
[ Colors : set, unset                             ]
 * Found these USE flags for www-client/ungoogled-chromium-126.0.6478.36_p1:
 U I
 - - X                        : Add support for X11
 + + bluetooth                : Enable Bluetooth. Disabling bluetooth does break WebAuthn. Could also break something else. Improved patch
                                is welcome.
 - - cfi                      : Build with CFI (Control Flow Integrity) enabled. It requires "-stdlib=libc++", see #40 for more details.
 + + clang                    : Use Clang compiler instead of GCC
 - - convert-dict             : Patch and build the convert_dict utility. The script will be installed into
                                /usr/lib64/chromium-browser/update-dicts.sh. More info here:
                                https://github.com/ungoogled-software/ungoogled-chromium/issues/188#issuecomment-444752907
 - - cromite                  : Apply also select patches from Cromite. Highly experimental! Please consider Cromite licensing terms when
                                deciding if you're allowed to distribute binaries built with these patches.
 - - cups                     : Add support for CUPS (Common Unix Printing System)
 - - custom-cflags            : Build with user-specified CFLAGS (unsupported)
 - - debug                    : Enable DCHECK feature with severity configurable at runtime. Mostly intended for debugging and
                                development, NOT RECOMMENDED for general use.
 + + enable-driver            : Build chromedriver
 - - gtk4                     : Build with GTK4 headers
 + + hangouts                 : Enable support for Google Hangouts features such as screen sharing
 - - headless                 : Build Ozone only with headless backend, NOT RECOMMENDED for general uses
 - - hevc                     : Enable HEVC decoding support. Should work with system-ffmpeg, but might require additional patching for
                                the built-in one.
 - - kerberos                 : Add kerberos support
 + + l10n_af                  : Afrikaans
 + + l10n_am                  : Amharic
 + + l10n_ar                  : Arabic
 + + l10n_bg                  : Bulgarian
 + + l10n_bn                  : Bengali
 + + l10n_ca                  : Catalan
 + + l10n_cs                  : Czech
 + + l10n_da                  : Danish
 + + l10n_de                  : German
 + + l10n_el                  : Modern Greek
 + + l10n_en-GB               : English (United Kingdom)
 + + l10n_es                  : Spanish
 + + l10n_es-419              : Spanish (Latin America)
 + + l10n_et                  : Estonian
 + + l10n_fa                  : Persian
 + + l10n_fi                  : Finnish
 + + l10n_fil                 : Filipino
 + + l10n_fr                  : French
 + + l10n_gu                  : Gujarati
 + + l10n_he                  : Hebrew
 + + l10n_hi                  : Hindi
 + + l10n_hr                  : Croatian
 + + l10n_hu                  : Hungarian
 + + l10n_id                  : Indonesian
 + + l10n_it                  : Italian
 + + l10n_ja                  : Japanese
 + + l10n_kn                  : Kannada
 + + l10n_ko                  : Korean
 + + l10n_lt                  : Lithuanian
 + + l10n_lv                  : Latvian
 + + l10n_ml                  : Malayalam
 + + l10n_mr                  : Marathi
 + + l10n_ms                  : Malay (macrolanguage)
 + + l10n_nb                  : Norwegian Bokmål
 + + l10n_nl                  : Dutch
 + + l10n_pl                  : Polish
 + + l10n_pt-BR               : Portuguese (Brazil)
 + + l10n_pt-PT               : Portuguese (Portugal)
 + + l10n_ro                  : Romanian
 + + l10n_ru                  : Russian
 + + l10n_sk                  : Slovak
 + + l10n_sl                  : Slovenian
 + + l10n_sr                  : Serbian
 + + l10n_sv                  : Swedish
 + + l10n_sw                  : Swahili (macrolanguage)
 + + l10n_ta                  : Tamil
 + + l10n_te                  : Telugu
 + + l10n_th                  : Thai
 + + l10n_tr                  : Turkish
 + + l10n_uk                  : Ukrainian
 + + l10n_ur                  : Urdu
 + + l10n_vi                  : Vietnamese
 + + l10n_zh-CN               : Chinese (China)
 + + l10n_zh-TW               : Chinese (Taiwan)
 - - libcxx                   : Use bundled C++ Standard Library (libc++)
 - - nvidia                   : Use libXNVCtrl library from x11-drivers/nvidia-drivers instead of the bundled one
 + + official                 : Enable Official build instead of Developer build
 - - optimize-thinlto         : Whether to enable ThinLTO optimizations. Turning ThinLTO optimizations on can substantially increase link
                                time and binary size, but they generally also make binaries a fair bit faster.
 + + optimize-webui           : Optimize parts of Chromium's UI written with web technologies (HTML/CSS/JS) for runtime performance
                                purposes. This does more work at compile time for speed benefits at runtime.
 - - override-data-dir        : Change default user data directory to "~/.config/ungoogled-chromium". No data moved automatically.
 - - pax-kernel               : Allow building on a PaX-enabled kernel
 - - pgo                      : Enable PGO. Requires bundled binary profile data in sources tree. Often requires masked/testing llvm.
 + + proprietary-codecs       : Enable proprietary codecs like H.264, MP3
 + + pulseaudio               : Add sound server support via media-libs/libpulse (may be PulseAudio or PipeWire)
 + + qt5                      : Add support for the Qt 5 application and UI framework
 + + qt6                      : Add support for the Qt 6 application and UI framework
 + + screencast               : Enable support for remote desktop and screen cast using media-video/pipewire
 - - system-abseil-cpp        : Use the system dev-cpp/abseil-cpp instead of the bundled one
 - - system-av1               : Use the system media-libs/libaom and media-libs/dav1d instead of the bundled ones
 - - system-brotli            : Use the system app-arch/brotli instead of the bundled one
 - - system-crc32c            : Use the system dev-libs/crc32c instead of the bundled one
 - - system-double-conversion : Use the system dev-libs/double-conversion instead of the bundled one
 - - system-ffmpeg            : Use the system media-video/ffmpeg instead of the bundled one
 - - system-harfbuzz          : Use the system media-libs/harfbuzz instead of the bundled one
 - - system-icu               : Use the system dev-libs/icu instead of the bundled one
 - - system-jsoncpp           : Use the system dev-libs/jsoncpp instead of the bundled one
 - - system-libevent          : Use the system dev-libs/libevent instead of the bundled one
 - - system-libusb            : Use the system dev-libs/libusb instead of the bundled one
 - - system-libvpx            : Use the system media-libs/libvpx instead of the bundled one
 - - system-openh264          : Use the system media-libs/openh264 instead of the bundled one. If disabled, it will restrict USE=bindist.
 - - system-openjpeg          : Use the system-wide media-libs/openjpeg instead of the bundled one. OpenJPEG use are exclusively for
                                Chromium's PDF viewer.
 - - system-png               : Use system libpng instead of the bundled one
 - - system-re2               : Use the system-wide dev-libs/re2 instead of the bundled one
 - - system-snappy            : Use the system-wide app-arch/snappy instead of the bundled one
 - - system-woff2             : Use the system media-libs/woff2 instead of the bundled one
 - - system-zstd              : Use the system app-arch/zstd instead of the bundled one
 - - thinlto                  : Build with ThinLTO support. LTO (Link Time Optimization) achieves better runtime performance through
                                whole-program analysis and cross-module optimization (highly recommended).
 + + vaapi                    : Enable Video Acceleration API for hardware decoding
 + + wayland                  : Enable dev-libs/wayland backend
 + + widevine                 : Unsupported closed-source DRM capability (required by Netflix VOD)
PF4Public commented 3 months ago

@mrusme ThreadPoolForeg looks familiar, but I cannot remember how I fixed that. It is most likely a new issue and it would be great if you could open a separate issue for that. Also it would help if you could obtain a full stack-trace from the crash. Also please make sure it is not a hardware (RAM) issue.