qutebrowser icon indicating copy to clipboard operation
qutebrowser copied to clipboard

qutebrowser on windows 11: dark mode causing crashes in google

Open tgharib opened this issue 3 years ago • 15 comments

Version info: https://paste.the-compiler.org/view/5491188f

Does the bug happen if you start with --temp-basedir?: No.

Description

I'm using qutebrowser on windows. When I create a new tab to do a google search, there's a 50% chance of the tab crashing.

Since I could NOT reproduce with qutebrowser --temp-basedir, I did some trial and error and I found the culprit was this setting c.colors.webpage.darkmode.enabled = True. Adding that setting to config.py seems to cause this buggy behavior.

How to reproduce

:open -t windows how to disable hotkeys !g results in this half the time.

tgharib avatar May 28 '22 06:05 tgharib

Adding

c.qt.force_software_rendering = "chromium"
c.qt.workarounds.remove_service_workers = True

to config.py and restarting qutebrowser did not fix the issue.

tgharib avatar May 28 '22 06:05 tgharib

This is an interesting bug. :open -t windows how to disable hot !g reliably works. But as soon as I add another letter :open -t windows how to disable hotk !g, it starts crashing. Adding more letters doesn't help.

Here is another way to reproduce the same issue:

  1. :open -t google.ca
  2. Type windows how to disable hotkeys and press enter

tgharib avatar May 28 '22 06:05 tgharib

Another example: :open -t lawnmower bla !g is OK but lawnmower blad !g crashes.

Also, the issue seems to be Google-specific. It doesn't seem to happen in DDG.

tgharib avatar May 28 '22 06:05 tgharib

Could you please try the qt6-v2 branch? #7202 has a Windows build linked. You should be able to try with --temp-basedir -s colors.webpage.darkmode.enabled true.

The-Compiler avatar May 28 '22 08:05 The-Compiler

Okay, problem solved with Qt 6. Well I guess that was an easy fix.

tgharib avatar May 29 '22 18:05 tgharib

Spoke too soon. With the qt6-2 branch, logging into gmail's inbox crashes with --temp-basedir -s colors.webpage.darkmode.enabled true but works fine with --temp-basedir.

tgharib avatar May 29 '22 20:05 tgharib

Reproduced. Just to make sure we're on the same page: The entire qutebrowser process crashes there, not just the renderer process, correct?

The-Compiler avatar May 30 '22 12:05 The-Compiler

Reproduced. Just to make sure we're on the same page: The entire qutebrowser process crashes there, not just the renderer process, correct?

Yes. I suppose this crash is different than the initial bug report.

tgharib avatar May 30 '22 13:05 tgharib

Let's keep both here for now, given that they are both windows specific and related to dark mode.

Off-hand, I have no idea what's happening. I can't reproduce them on Linux, and the crash reports I get from DebugDiag are rather useless (stacktrace for the Google Inbox crash).

Will probably need a Qt with proper debug symbols on Windows to say more. Building/debugging stuff on Windows is a major pain, however...

The-Compiler avatar May 30 '22 14:05 The-Compiler

Will probably need a Qt with proper debug symbols on Windows to say more. Building/debugging stuff on Windows is a major pain, however...

Eh, I've done it multiple times before. It's not that painful. If I have free time this upcoming weekend, I'll build Qt on Windows with debug symbols.

Btw, msys2 provides an easy way of building native Qt on Windows, using the arch package manager, pacman.

tgharib avatar May 30 '22 14:05 tgharib

If not building with MSVC, it's questionable whether you will get the same issue, given that it's Windows-specific. Note that you will also need to build PyQt, and as far as I remember, extension modules should usually be compiled the same way that Python was:

You will still need the C compiler that was used to build Python; typically Microsoft Visual C++.

So not sure if that approach will work at all. I suppose you might want to try reproducing it with a C++ example though, I don't think it's specific to qutebrowser at all. You should be able to pass --blink-settings=forceDarkModeEnabled=true --dark-mode-settings=ImagePolicy=2 to them (assuming Qt 6.2/6.3) to reproduce this.

The-Compiler avatar May 30 '22 14:05 The-Compiler

Actually, I was planning to build with MSVC and then just swapping the Qt DLLs in the qutebrowser build you provided earlier

I threw out msys2 in case you weren't aware of it but it looks like it's not that easily feasible because of pyqt. Btw, why can't I just build pyqt with msys2/pacman? https://archlinux.org/packages/extra/x86_64/python-pyqt6/ In fact, I should be able to just build qutebrowser itself through pacman https://archlinux.org/packages/community/any/qutebrowser/

tgharib avatar May 30 '22 15:05 tgharib

I have no idea. I suppose you could have a msys2 Python + PyQt + QtWebEngine indeed, and perhaps that would give you proper debug symbols. I would't be surprised if the issue doesn't show up anymore in that configuration, however.

The-Compiler avatar May 30 '22 15:05 The-Compiler

So I built Qt 6.3 debug from source using Visual Studio 2022 and replaced the DLLs in qutebrowser and then qutebrowser simply refused to launch. No output in terminal either. I don't want to mess with building PyQt from source too or sinking too much time into this. I'm going to try and see if I can build qutebrowser in msys2 for now.

tgharib avatar Jun 05 '22 20:06 tgharib

It's been a while since I've messed with msys2 but apparently, there are both msys2 packages and mingw packages (we're interested in mingw). It looks like it doesn't contain the entire arch repo either as a search for qutebrowser returns no results. It does have both qt6 and pyqt and also has python. At this point however, I don't want to spend time on this, at least until I get a proper tiling wm setup on windows.

tgharib avatar Jun 05 '22 20:06 tgharib

Having a very similar issue on NixOS and qutebrowser. A few months back Google Meet started crashing every time I opened a meeting in qutebrowser. I have had to use chromium for these meetings since then as I could never get to the bottom of it.

However, just now I was going through my config disabling settings to see if anything would help and it seems disabling dark mode actually fixed this issue. So it seems this is not just specific to windows, however I don't crash on google search ever, just google meet.

Wasn't sure if this is worthy of a new issue so I thought I'd post here first.

nrdxp avatar Apr 30 '23 15:04 nrdxp

@nrdxp I suggest you open a new issue and link to this one. Would be good to have your version information and all, I doubt it's related directly to this issue (which is almost a year old). In any case, things like this are typically problems with QtWebEngine/Chromium, so there's probably little to be done other than forwarding it upstream.

The-Compiler avatar Apr 30 '23 15:04 The-Compiler

decided to report directly upstream: https://bugreports.qt.io/browse/QTBUG-113369

nrdxp avatar May 03 '23 15:05 nrdxp

I'm also able to reproduce the crash on Manjaro Linux (Kernel 6.3.4-2) under Qt6 on wayland. Crashing goes away if browser darkmode is left disabled.

The below log was harvested from the crash recovery dialog by creating a clean basedir, triggering the crash, then reopening the browser again with same basedir. The command used for this was qutebrowser --basedir /tmp/qutetemp -s colors.webpage.darkmode.enabled true.

==== Fault log ====
Fatal Python error: Segmentation fault

Current thread 0x00007f08b6a72740 (most recent call first):
  File "/usr/lib/python3.10/site-packages/qutebrowser/app.py", line 140 in qt_mainloop
  File "/usr/lib/python3.10/site-packages/qutebrowser/app.py", line 130 in run
  File "/usr/lib/python3.10/site-packages/qutebrowser/qutebrowser.py", line 245 in main
  File "/usr/bin/qutebrowser", line 33 in <module>

Extension modules: PyQt6.QtCore, PyQt6.QtGui, PyQt6.QtWidgets, markupsafe._speedups, yaml._yaml, PyQt6.QtNetwork, PyQt6.QtQml, PyQt6.QtOpenGL, PyQt6.QtDBus, PyQt6.QtPrintSupport, PyQt6.QtWebChannel, PyQt6.QtWebEngineCore, PyQt6.QtWebEngineWidgets, PyQt6.QtSql (total: 14)


==== Timestamps ====
Launch: Tue May 30 14:00:30 2023
Crash: Tue May 30 14:00:30 2023

==== Version info ====
         ______     ,,
    ,.-"`      | ,-` |
  .^           ||    |
 /    ,-*^|    ||    |
;    /    |    ||    ;-*```^*.
;   ;     |    |;,-*`         \
|   |     |  ,-*`    ,-"""\    \
|    \   ,-"`    ,-^`|     \    |
 \    `^^    ,-;|    |     ;    |
  *;     ,-*`  ||    |     /   ;;
    `^^`` |    ||    |   ,^    /
          |    ||    `^^`    ,^
          |  _,"|        _,-"
          -*`   ****"""``

qutebrowser v2.5.4
Git commit: f26ea37c4-dirty on master (2023-05-22 19:35:35 +1200)
Backend: QtWebEngine 6.5, based on Chromium 108.0.5359.220 (from api)
Qt: 6.5.0

CPython: 3.10.10
PyQt: 6.5.0

sip: no
colorama: 0.4.6
jinja2: 3.1.2
pygments: 2.14.0
yaml: 6.0
adblock: 0.6.0
objc: no
PyQt6.QtWebEngineCore: 6.5.0
pdf.js: 3.5.141 (/usr/share/pdf.js/build/pdf.js)
sqlite: 3.41.2
QtNetwork SSL: OpenSSL 3.0.8 7 Feb 2023

Style: Adwaita::Style
Platform plugin: wayland
OpenGL: AMD, 4.6 (Compatibility Profile) Mesa 23.2.0-devel (git-0b259e72bd)
Platform: Linux-6.3.4-2-MANJARO-x86_64-with-glibc2.37, 64bit
Linux distribution: Manjaro Linux (manjaro)
Frozen: False
Imported from /usr/lib/python3.10/site-packages/qutebrowser
Using Python from /usr/bin/python3
Qt library executable path: /usr/lib/qt6, data path: /usr/share/qt6

Paths:
cache: /tmp/qutetemp/cache
config: /tmp/qutetemp/config
data: /tmp/qutetemp/data
runtime: /tmp/qutetemp/runtime
system data: /usr/share/qutebrowser

Autoconfig loaded: yes
Config.py: no config.py was loaded
Uptime: 0:00:00

==== Config ====
<Default configuration>

==== Environment ====
LANG = en_US.UTF-8
LC_ADDRESS = en_US.UTF-8
LC_MEASUREMENT = en_US.UTF-8
LC_MESSAGES = en_US.UTF-8
LC_MONETARY = en_US.UTF-8
LC_PAPER = en_US.UTF-8
LC_TIME = en_US.UTF-8
PATH = /home/chao/perl5/bin:/home/chao/perl5/bin:/home/chao/perl5/bin:/home/chao/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/home/chao/.bin:/home/chao/.emacs.d/bin
QTWEBENGINE_DICTIONARIES_PATH = /tmp/qutetemp/data/qtwebengine_dictionaries
QT_IM_MODULE = fcitx
QT_STYLE_OVERRIDE = adwaita-dark
XDG_BACKEND = wayland
XDG_CURRENT_DESKTOP = Hyprland
XDG_RUNTIME_DIR = /run/user/1000
XDG_SEAT = seat0
XDG_SESSION_CLASS = user
XDG_SESSION_ID = 1
XDG_SESSION_TYPE = wayland
XDG_VTNR = 1
XMODIFIERS = @im=fcitx

==== History ====
ResultRow(url='https://meet.google.com/?hs=193', title='Google Meet', atime=1685469620, redirect=0)
ResultRow(url='https://accounts.google.com/signin/v2/challenge/totp?TL=[REDACTED]&checkConnection=youtube%3A109%3A0&checkedDomains=youtube&cid=3&continue=https%3A%2F%2Fmeet.google.com%3Fhs%3D193&dsh=[REDACTED]&flowEntry=ServiceLogin&flowName=GlifWebSignIn&ifkv=[REDACTED]&ltmpl=meet&pstMsg=1', title='Sign in - Google Accounts', atime=1685469613, redirect=1)
ResultRow(url='https://accounts.google.com/signin/v2/challenge/totp?TL=[REDACTED]&checkConnection=youtube%3A109%3A0&checkedDomains=youtube&cid=3&continue=https%3A%2F%2Fmeet.google.com%3Fhs%3D193&dsh=[REDACTED]&flowEntry=ServiceLogin&flowName=GlifWebSignIn&ifkv=[REDACTED]&ltmpl=meet&pstMsg=1', title='Sign in - Google Accounts', atime=1685469613, redirect=0)
ResultRow(url='https://accounts.google.com/v3/signin/identifier?dsh=[REDACTED]&continue=https%3A%2F%2Fmeet.google.com%3Fhs%3D193&ifkv=[REDACTED]&ltmpl=meet&flowName=GlifWebSignIn&flowEntry=ServiceLogin', title='Sign in - Google Accounts', atime=1685469592, redirect=0)
ResultRow(url='http://meet.google.com/', title='Google Meet: Online Video Meetings and Calls | Google Workspace', atime=1685469589, redirect=1)
ResultRow(url='https://apps.google.com/meet/', title='Google Meet: Online Video Meetings and Calls | Google Workspace', atime=1685469589, redirect=0)
ResultRow(url='https://start.duckduckgo.com/', title='DuckDuckGo — Privacy, simplified.', atime=1685469585, redirect=0)

chaorace avatar May 30 '23 18:05 chaorace

FYI @nrdxp the QT bug report was pending reproduction steps. I went ahead and commented reproduction steps for qutebrowser, but I'm not really sure if that's good enough for the WebEngine folks?

chaorace avatar May 30 '23 19:05 chaorace

I added a comment on how to reproduce it with their simplebrowser example, and took the freedom of changing the state to "reported" again :upside_down_face:

The-Compiler avatar Jun 02 '23 10:06 The-Compiler

Looks like this is getting fixed upstream: Fix crash on Google Meet when dark mode is enabled (I361df0af) · Gerrit Code Review

Assuming the other Google pages were the same issue.

The-Compiler avatar Jul 06 '23 18:07 The-Compiler

The fix made it into Qt 6.5.3 which is planned for early September.

The-Compiler avatar Aug 07 '23 09:08 The-Compiler