Anki Forums

Webviews blank on Linux

On my 32bit laptop running Debian bullseye, the Anki windows are mostly blank (see screenshot below).
I run Anki from source and held the shift key while starting Anki.

I had some issues in the previous weeks (with .28) where Anki would close immediately after starting and the console printing something about a segementation fault. These occured only directly after pulling and building and were always resolved after logging out and back in again, but now restarting the computer doesn’t help.

debug info
Anki 2.1.29 (15c9cd91) Python 3.8.5 Qt 5.14.2 PyQt 5.15.0
Platform: Linux
Flags: frz=False ao=False sv=2
Add-ons, last update check: 2020-07-26 06:41:14


===Add-ons (active)===
(add-on provided name [Add-on folder, installed at, version, is config changed])
'' ['print_as_flashcards', 0, 'None', '']
'' ['puppy_reinforcement', 0, 'None', '']
'' ['right_hand_reviews', 0, 'None', mod]
'' ['tagedit_subtag_completer', 0, 'None', '']
Add Hyperlink ['318752047', 2020-06-18T15:22, 'None', '']
Anki Zoom ['538879081', 2020-04-04T02:20, 'v1.1.3', '']
AnkiWebView Inspector ['31746032', 2019-05-03T00:43, 'None', '']
Batch Editing ['291119185', 2019-06-17T17:52, 'None', '']
Cloze Overlapper ['cloze_overlapper', 2019-08-11T08:03, 'None', '']
Extended Card Stats During Review ['1008566916', 2018-10-03T14:53, 'None', '']
Extended Schema Hash ['1187737890', 2020-01-19T14:09, 'None', '']
Field History ['1247884413', 2019-01-08T19:34, 'None', mod]
Frozen Fields ['516643804', 2020-03-01T05:12, 'None', '']
Hierarchical Tags ['anki-hierarchical-tags', 0, 'None', '']
Highlight Search Results in the Browser ['225180905', 2019-11-27T16:06, 'None', '']
Image Occlusion Enhanced ['image_occlusion_enhanced', 2019-09-11T13:45, 'None', '']
Leaderboard ['41708974', 2020-07-13T21:24, 'None', mod]
Mini Format Pack ['mini_format_pack', 2019-08-12T09:37, 'None', '']
Multiple Choice for Anki ['1566095810', 2020-04-10T07:50, 'None', '']
Opening the same window multiple time ['354407385', 2020-05-16T02:59, 'None', '']
Pop-up Dictionary ['popup_dictionary', 2019-10-18T20:28, 'None', '']
Quick tagging 21 ['304770511', 2020-02-11T07:17, 'None', mod]
Review Heatmap ['review_heatmap', 2020-03-22T06:57, 'None', '']
Search and Replace Tags ['138501288', 2018-10-01T16:47, 'None', '']
Spell Check ['spell_check', 2020-03-17T13:19, 'None', '']
Symbols ['1461102936', 2019-06-17T17:52, 'None', mod]
Trigger and actions change one card depending on what occurs on another card ['1981494159', 2020-05-04T22:53, 'None', mod]
Visual Feedback for Reviews ['review_feedback', 2020-01-29T20:43, 'None', '']

===IDs of active AnkiWeb add-ons===
1008566916 1187737890 1247884413 138501288 1461102936 1566095810 1981494159 225180905 291119185 304770511 31746032 318752047 354407385 41708974 516643804 538879081

===Add-ons (inactive)===
(add-on provided name [Add-on folder, installed at, version, is config changed])
Anki Habitica for 21 ['1758045507', 2020-03-24T09:28, 'None', mod]
Keep model of add cards ['424778276', 2020-05-17T01:18, 'None', '']
console output

zjosua@debian:~/sw_dev/anki$ ./run
make: Entering directory ‘/home/zjosua/sw_dev/anki’
make[1]: Entering directory ‘/home/zjosua/sw_dev/anki/rslib’
make[1]: Nothing to be done for ‘develop’.
make[1]: Leaving directory ‘/home/zjosua/sw_dev/anki/rslib’
make[1]: Entering directory ‘/home/zjosua/sw_dev/anki/rspy’
make[1]: Nothing to be done for ‘develop’.
make[1]: Leaving directory ‘/home/zjosua/sw_dev/anki/rspy’
make[1]: Entering directory ‘/home/zjosua/sw_dev/anki/pylib’
make[1]: Nothing to be done for ‘develop’.
make[1]: Leaving directory ‘/home/zjosua/sw_dev/anki/pylib’
make[1]: Entering directory ‘/home/zjosua/sw_dev/anki/ts’
make[1]: Nothing to be done for ‘develop’.
make[1]: Leaving directory ‘/home/zjosua/sw_dev/anki/ts’
make[1]: Entering directory ‘/home/zjosua/sw_dev/anki/qt’
rsync -a …/ts/dist/ aqt_data/web/
make[1]: Leaving directory ‘/home/zjosua/sw_dev/anki/qt’
Starting Anki…
…/…/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.cc:**CRASHING**:seccomp-bpf failure in syscall 0403
…/…/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.cc:**CRASHING**:seccomp-bpf failure in syscall 0403
…/…/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.cc:**CRASHING**:seccomp-bpf failure in syscall 0403
…/…/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.cc:**CRASHING**:seccomp-bpf failure in syscall 0403
…/…/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.cc:**CRASHING**:seccomp-bpf failure in syscall 0403
…/…/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.cc:**CRASHING**:seccomp-bpf failure in syscall 0403
…/…/3rdparty/chromium/sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.cc:**CRASHING**:seccomp-bpf failure in syscall 0403
make: Leaving directory ‘/home/zjosua/sw_dev/anki’

Screenshot:

I presume if you check out an older Anki version the issue still exists? If so it’s likely to be some change to your (Py)Qt installation or video drivers - something seems broken with WebEngine.

Yes indeed. I tried with 8bd5d75 (bump version to .28) and it was just the same results.

The mismatch between the Qt version and the PyQt version might cause the issue.

No, PyQt and Qt versions don’t need to match.
This might be related.
There’s a suggested fix, but I guess I’ll have to build Qt (or PyQt?) myself to find out if it works…

Did you try passing --disable-seccomp-filter-sandbox or one of the other mentioned arguments on the Anki command line?

Yes I just did that now. They need to be set as an environment variable though (like env QTWEBENGINE_CHROMIUM_FLAGS="--disable-seccomp-filter-sandbox" ./run) because if I just append them to ./run, bash thinks they are a file to be opened with ./run.

All the suggested flags (--disable-seccomp-filter-sandbox, --no-sandbox and --single-process) allow me to open Anki without the failure in syscall error, and the WebViews actually display what they are supposed to.
However the following error appears every time a WebView closes:

Caught exception:
Traceback (most recent call last):
  File "/home/zjosua/sw_dev/anki/qt/aqt/webview.py", line 37, in cmd
    return json.dumps(self.onCmd(str))
  File "/home/zjosua/sw_dev/anki/qt/aqt/webview.py", line 123, in _onCmd
    return self._onBridgeCmd(str)
  File "/home/zjosua/sw_dev/anki/qt/aqt/webview.py", line 529, in _onBridgeCmd
    if self._shouldIgnoreWebEvent():
  File "/home/zjosua/sw_dev/anki/qt/aqt/webview.py", line 522, in _shouldIgnoreWebEvent
    if sip.isdeleted(self):
TypeError: isdeleted() argument 1 must be sip.simplewrapper, not AnkiWebView

These didn’t show up when I didn’t pass any arguments (and got just blank WebViews), but I was able to provoke something similar when I started navigating with shortcuts:

Caught exception:
Traceback (most recent call last):
  File "/home/zjosua/sw_dev/anki/qt/aqt/main.py", line 997, in onStudyKey
    self.moveToState("review")
  File "/home/zjosua/sw_dev/anki/qt/aqt/main.py", line 658, in moveToState
    self.clearStateShortcuts()
  File "/home/zjosua/sw_dev/anki/qt/aqt/main.py", line 991, in clearStateShortcuts
    sip.delete(qs)
TypeError: delete() argument 1 must be sip.simplewrapper, not QShortcut

If you’re running from source, perhaps it’s an issue with your PyQt version.

An issue as in I’m using the wrong version?
I am still using 5.15.0.

Maybe changing the sip version will help? Not sure, sorry.

Apparently there are two sources where sip can be imported from:
The sip module installed by pip install sip and there is also a module called sip in the PyQt5 module.
I don’t know what the difference is, but it seems relevant here.

In Anki’s qt.py, the import looks like this:

try:
    from PyQt5 import sip
except ImportError:
    import sip  # type: ignore

Again, not sure what the point of this is.

But, trying stuff without knowing what I am doing (not sure if I learned this in med school or back when I still worked as an electronics technician…), I found that when I reduce these four lines to just import sip, it seems to work on the 32bit machine (at first glance).
I didn’t test much, and not at all on a 64bit system. Might do so tomorrow though.

import sip does work on the 32bit machine with the latest commit (340c749d).

On the 64bit device, both import sip and from PyQt5 import sip work (also tested with the latest commit.

Looks like the current code is due to some changes in PyQt v5.11.

Looks like v5.15 changed something that breaks on 32bit computers.