NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.71k stars 13.85k forks source link

anki: NixOS 23.05: Received signal 11 SEGV_ACCERR 7fe40a36a75a #259379

Open n-riesco opened 1 year ago

n-riesco commented 1 year ago

Describe the bug

Anki terminated by SIGSEV signal while adding a card.

Steps To Reproduce

Steps to reproduce the behavior:

  1. Launch anki in a desktop environment using Wayland (see https://github.com/NixOS/nixpkgs/issues/259379#issuecomment-1751819192 )
  2. Open a deck
  3. Click on Add to add a card
  4. Type some text either on the front or the back text box
  5. Select some text
  6. Press ctrl+c to copy the selection to the clipboard
  7. After a few seconds, anki is terminated by a SIGSEV signal

Expected behavior

Anki isn't terminated

Screenshots

N/A

Additional context

Console output:

$ anki
Running with temporary Qt5 compatibility shims.
Run with DISABLE_QT5_COMPAT=1 to confirm compatibility with Qt6.
Preparing to run...
Qt warning: QGuiApplication::setDesktopFileName: the specified desktop file name ends with .desktop. For compatibility reasons, the .desktop suffix will be removed. Please specify a desktop file name without .desktop suffix 
Starting main loop...
JS warning /_anki/js/note_creator.js:4 No version information available for component [tex]/noerrors
JS warning /_anki/js/note_creator.js:4 No version information available for component [tex]/mathtools
JS warning /_anki/js/note_creator.js:4 No version information available for component [tex]/mhchem
JS warning /_anki/js/note_creator.js:4 No version information available for component [tex]/noerrors
JS warning /_anki/js/note_creator.js:4 No version information available for component [tex]/mathtools
JS warning /_anki/js/note_creator.js:4 No version information available for component [tex]/mhchem
JS warning /_anki/js/note_creator.js:4 No version information available for component [tex]/noerrors
JS warning /_anki/js/note_creator.js:4 No version information available for component [tex]/mathtools
JS warning /_anki/js/note_creator.js:4 No version information available for component [tex]/mhchem
Received signal 11 SEGV_ACCERR 7fe40a36a75a
#0 0x7fe46c1e48a5 base::debug::CollectStackTrace()
#1 0x7fe46c123666 base::debug::StackTrace::StackTrace()
#2 0x7fe46c1e4cd3 base::debug::(anonymous namespace)::StackDumpSignalHandler()
#3 0x7fe47cf72d60 (/nix/store/46m4xx889wlhsdj72j38fnlyyvvvvbyb-glibc-2.37-8/lib/libc.so.6+0x38d5f)
#4 0x7fe474fed4c2 QInternalMimeData::formatsHelper()
#5 0x7fe46131c2ac QtWaylandClient::QWaylandDataSource::QWaylandDataSource()
#6 0x7fe46131628d QtWaylandClient::QWaylandClipboard::setMimeData()
#7 0x7fe4759ecffb meth_QClipboard_setMimeData
#8 0x7fe47d465103 cfunction_call
#9 0x7fe47d31f930 _PyObject_MakeTpCall.localalias
#10 0x7fe47d25ec29 call_function
#11 0x7fe47d26539b _PyEval_EvalFrameDefault
#12 0x7fe47d3a7206 _PyEval_Vector
#13 0x7fe47d25ec78 call_function
#14 0x7fe47d263221 _PyEval_EvalFrameDefault
#15 0x7fe47d3a7206 _PyEval_Vector
#16 0x7fe47901f9d0 PyQtSlot::call()
#17 0x7fe47901fe60 PyQtSlot::invoke()
#18 0x7fe4790200f0 PyQtSlotProxy::unislot()
#19 0x7fe47902154f PyQtSlotProxy::qt_metacall()
#20 0x7fe4789ac118 doActivate<>()
#21 0x7fe4789bc8aa QTimer::timeout()
#22 0x7fe478f1892b sipQTimer::timerEvent()
#23 0x7fe47899c8ad QObject::event()
#24 0x7fe478f187db sipQTimer::event()
#25 0x7fe473d90dd1 QApplicationPrivate::notify_helper()
#26 0x7fe47397ec7e sipQApplication::notify()
#27 0x7fe47894bc08 QCoreApplication::notifyInternal2()
#28 0x7fe478ac0389 QTimerInfoList::activateTimers()
#29 0x7fe478bd66b4 timerSourceDispatch()
#30 0x7fe478316dbd g_main_context_dispatch
#31 0x7fe478317068 g_main_context_iterate.constprop.0
#32 0x7fe4783170fc g_main_context_iteration
#33 0x7fe478bd6a7c QEventDispatcherGlib::processEvents()
#34 0x7fe478957ef3 QEventLoop::exec()
#35 0x7fe4789541d8 QCoreApplication::exec()
#36 0x7fe47397dadb meth_QApplication_exec
#37 0x7fe47d4650e7 cfunction_call
#38 0x7fe47d31f930 _PyObject_MakeTpCall.localalias
#39 0x7fe47d25ec29 call_function
#40 0x7fe47d26539b _PyEval_EvalFrameDefault
#41 0x7fe47d3a7206 _PyEval_Vector
#42 0x7fe47d25ec78 call_function
#43 0x7fe47d263221 _PyEval_EvalFrameDefault
#44 0x7fe47d3a7206 _PyEval_Vector
#45 0x7fe47d25ec78 call_function
#46 0x7fe47d263221 _PyEval_EvalFrameDefault
#47 0x7fe47d3a7206 _PyEval_Vector
#48 0x7fe47d3aef8f PyEval_EvalCode.localalias
#49 0x7fe47d4a6040 run_mod
#50 0x7fe47d4ae906 _PyRun_SimpleFileObject.localalias
#51 0x7fe47d4af121 _PyRun_AnyFileObject.localalias
#52 0x7fe47d4b426a Py_RunMain.localalias
#53 0x7fe47cf5dace __libc_start_call_main
#54 0x7fe47cf5db89 __libc_start_main_alias_2
#55 0x000000401075 _start
  r8: 0000000000000007  r9: 00000000035dc9d0 r10: d009fc6540cd1c27 r11: 00007fe47d111aa0
 r12: 00007fe3f41128b0 r13: 000000000152ee00 r14: 0000000000000000 r15: 00007fe46134db10
  di: 00007ffffbcd9d70  si: 00007fe3f41128b0  bp: 00000000035dc5d0  bx: 00007ffffbcd9d70
  dx: 00007fe461349fa0  ax: 00007fe40a36a6f2  cx: 00000000000000e1  sp: 00007ffffbcd9ce0
  ip: 00007fe474fed4c2 efl: 0000000000010202 cgf: 002b000000000033 erf: 0000000000000004
 trp: 000000000000000e msk: 0000000000000000 cr2: 00007fe40a36a75a
[end of stack trace]
fish: Job 1, 'anki' terminated by signal SIGSEGV (Address boundary error)

Notify maintainers

@oxij @euank

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.


[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 6.1.55, NixOS, 23.05 (Stoat), 23.05.4076.8a4c17493e5c`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.13.5`
 - channels(root): `"nixos-23.05"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos````
n-riesco commented 1 year ago

Same behaviour with anki-bin.

chewblacka commented 1 year ago

I can't seem to replicate this issue on NixOS 23.05.

n-riesco commented 1 year ago

I have this issue in two different machines using similar configuration.

I don't think any of the overlays I'm using are relevant to this issue, but in case they are, here's a copy:

# Edit this configuration file to define what should be installed on
# your system.  Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).
{
  config,
  pkgs,
  ...
}: {
  nixpkgs.overlays = [
    # Install x11docker v7.4.2 (as v7.6.0 is broken):
    #   https://github.com/mviereck/x11docker/issues/485
    #   https://github.com/mviereck/x11docker/issues/493
    (final: prev: {
      x11docker = prev.x11docker.overrideAttrs (finalAttrs: prevAttrs: rec {
        version = "7.4.2";
        src = prev.fetchFromGitHub {
          owner = "mviereck";
          repo = "x11docker";
          rev = "v${version}";
          sha256 = "sha256-oyxD6VCut7OfFYozdP0D2+ocOvidTrtaYrh0oCfZzBY=";
        };
      });
    })

    ## Install anki v2.1.65:
    ##   https://github.com/NixOS/nixpkgs/pull/229480
    #(final: prev: {
    #  anki = prev.anki.overrideAttrs (finalAttrs: prevAttrs: rec {
    #    version = "2.1.65";
    #    rev = "aa9a734f695d0b0981aa3c0aaa2745ce86832f08";
    #    src = prev.fetchFromGitHub {
    #      owner = "ankitects";
    #      repo = "anki";
    #      rev = version;
    #      hash = "sha256-l+RTot8pJFJDDiapmQdKJ9WfwAuwRFiNJMbX+fBETeU=";
    #      fetchSubmodules = true;
    #    };
    #    cargoDeps = prev.rustPlatform.importCargoLock {
    #      lockFile = prev.fetchurl {
    #        url = "https://raw.githubusercontent.com/euank/nixpkgs/f129e294b3f51ddfc3d1c0e47aac8a3b29ceee07/pkgs/games/anki/Cargo.lock";
    #        hash = "sha256-FtEAmECOTBevdSGX4LJOsNlF6IVEebO0pt2XJi6KbgI=";
    #      };
    #      outputHashes = {
    #        "csv-1.1.6" = "sha256-w728ffOVkI+IfK6FbmkGhr0CjuyqgJnPB1kutMJIUYg=";
    #        "linkcheck-0.4.1" = "sha256-S93J1cDzMlzDjcvz/WABmv8CEC6x78E+f7nzhsN7NkE=";
    #        "percent-encoding-iri-2.2.0" = "sha256-kCBeS1PNExyJd4jWfDfctxq6iTdAq69jtxFQgCCQ8kQ=";
    #      };
    #    };
    #    yarnOfflineCache = prev.fetchYarnDeps {
    #      yarnLock = "${src}/yarn.lock";
    #      hash = "sha256-66mYsHojQQBfLTHd12+/HEf7FKF5Y2RZRFeYRS2yZco=";
    #    };
    #    broken = prev.stdenv.isDarwin;
    #  });
    #})

    # Add missing pkgs in the FHS environment of appimage-run
    # Note: This overlay is required to run `czkawka.appImage`.
    #   https://github.com/NixOS/nixpkgs/issues/68267
    (final: prev: {
      appimage-run = prev.appimage-run.override {
        extraPkgs = pkgs:
          with pkgs; [
            gtk4
          ];
      };
    })

    # firefox: Add action to .desktop file to create a temp profile
    (self: super: let
      launcherName = "firefox-with-new-temp-profile";
      launcherScript = pkgs.writeShellScriptBin "${launcherName}" ''
        firefox -profile `mktemp -d` -no-remote -new-instance "$@"
      '';
    in {
      firefox = super.firefox.overrideAttrs (prevAttrs: {
        desktopItem = prevAttrs.desktopItem.override (prevAttrs: {
          actions =
            prevAttrs.actions
            // {
              new-temp-profile = {
                name = "Open a New Temporary Profile";
                exec = "${launcherScript}/bin/${launcherName} %U";
              };
            };
        });
      });
    })

    # syncthing: install .desktop files and icons
    (self: super: {
      syncthing = super.syncthing.overrideAttrs (oldAttrs: {
        postInstall = ''
          ${oldAttrs.postInstall}

          # .desktop files
          sed -i "s:/usr/bin/syncthing:$out/bin/syncthing:" etc/linux-desktop/syncthing-start.desktop
          sed -i "s:/usr/bin/syncthing -browser-only:$out/bin/syncthing:" etc/linux-desktop/syncthing-ui.desktop
          install -D etc/linux-desktop/syncthing-start.desktop -t $out/share/applications
          install -D etc/linux-desktop/syncthing-ui.desktop -t $out/share/applications

          # icons
          install -D assets/logo-32.png $out/share/icons/hicolor/32x32/apps/syncthing.png
          install -D assets/logo-64.png $out/share/icons/hicolor/64x64/apps/syncthing.png
          install -D assets/logo-128.png $out/share/icons/hicolor/128x128/apps/syncthing.png
          install -D assets/logo-256.png $out/share/icons/hicolor/256x256/apps/syncthing.png
          install -D assets/logo-512.png $out/share/icons/hicolor/512x512/apps/syncthing.png
          install -D assets/logo-only.svg $out/share/icons/hicolor/scalable/apps/syncthing.svg
        '';
      });
    })
  ];
}
n-riesco commented 1 year ago

I've also set:

  system.autoUpgrade.enable = true;
  system.autoUpgrade.allowReboot = false;

Is there anything else I can provide?

chewblacka commented 1 year ago

Is there anything else I can provide?

What anki version are you using? Your overlay is for 2.1.65, but the 23.05 repo version is 2.1.61. Did you add the overlay after encountering the bug?

n-riesco commented 1 year ago

Anki 2.1.61 (taken from the debug info in the about window):

    Anki 2.1.61 (0c1eaf4c) Python 3.10.12 Qt 6.5.2 PyQt 6.5.2
    Platform: Linux-6.1.55-x86_64-with-glibc2.37
    Flags: frz=False ao=False sv=1
    Add-ons, last update check: 2023-10-07 13:08:15

    ===Add-ons (active)===
    (add-on provided name [Add-on folder, installed at, version, is config changed])

    ===IDs of active AnkiWeb add-ons===

    ===Add-ons (inactive)===
    (add-on provided name [Add-on folder, installed at, version, is config changed])

I tested the overlay for Anki 2.1.65 after encountering the issue. The issue is still present in 2.1.65.


More info from my machine:

$ exa -Fla /nix/store/ | rg anki
.r--r--r--  2.4k root  1 Jan  1970 8wmwr491py52kqn31r89jl9gp05fnb8h-anki-pyenv-2.1.61.drv
dr-xr-xr-x     - root  1 Jan  1970 47mpgn0wjkrw50id4vp29156wpkav0jc-anki-2.1.61-doc/
dr-xr-xr-x     - root  1 Jan  1970 2433x5vhrx018q2qzanki30ssnd0gs0v-xl2tpd-1.3.18/
dr-xr-xr-x     - root  1 Jan  1970 cpkdwy89lk4fnh4mkgsiqrnnn3xcdb4z-anki-2.1.61-man/
.r--r--r--   14k root  1 Jan  1970 i0gczka5s7q8l7q7qgw47l4r0gyvad52-anki-2.1.61.drv
dr-xr-xr-x     - root  1 Jan  1970 kmdiliiv6j4d313qa5y018p960h5lndb-anki-2.1.61-man/
dr-xr-xr-x     - root  1 Jan  1970 pz0l66sp0dw550ia0l086pkxgjs1gzq3-anki-2.1.61-doc/
dr-xr-xr-x     - root  1 Jan  1970 vwdcc5q1yv9fvxn1is2qma4sr5iz15b2-anki-2.1.61/
.r--r--r--  2.3k root  1 Jan  1970 wiixyqhwvqfi9js0k695zs52hyi76b09-anki-nodemodules-2.1.61.drv
dr-xr-xr-x     - root  1 Jan  1970 zpjxj4lw9wkzkf8zl6h408ysv1y80prj-anki-2.1.61/
.r--r--r--   14k root  1 Jan  1970 zr8xrk4sq5v5bv5mh9ngd71gngillzai-anki-2.1.61.drv

$ readlink (which anki)
/nix/store/zpjxj4lw9wkzkf8zl6h408ysv1y80prj-anki-2.1.61/bin/anki

$ curl https://cache.nixos.org/zpjxj4lw9wkzkf8zl6h408ysv1y80prj.narinfo
StorePath: /nix/store/zpjxj4lw9wkzkf8zl6h408ysv1y80prj-anki-2.1.61
URL: nar/1iw0x30n2cf1mz86sw6ldmkjis1m3mnxxpnbs2iw9ck1inw3sj28.nar.xz
Compression: xz
FileHash: sha256:1iw0x30n2cf1mz86sw6ldmkjis1m3mnxxpnbs2iw9ck1inw3sj28
FileSize: 10530856
NarHash: sha256:0l6r5wkxm42f9c6jr7bc1c6514926fs45cv75m9fxlp0q62i3b4s
NarSize: 60171640
References: 054gfab8w1bsi6ibfdnhhzmz7gkgmlx6-python3.10-protobuf-4.21.12 0cgalh74gkr419hwm66c0shsqy9mhc7s-python3.10-Flask-Cors-3.0.10 1f14mgba7glw65l0j7zy80zhckdww72p-python3.10-certifi-2022.12.07 1r8q6hlv89fyqdj7brxsgxs0fp78gdw5-python3.10-markdown-3.4.3 35akn4pg0jmi6fk1pv640yhxg25a01sr-python3.10-idna-3.4 3m2iv1as9xja71q9aj4qrj91rkg00wm6-python3.10-pyqt6-sip-13.5.1 41acvmj08y0xays6dy6psa55ifdjzmqg-python3.10-itsdangerous-2.1.2 46m4xx889wlhsdj72j38fnlyyvvvvbyb-glibc-2.37-8 4h10b69s5lqiazxf1i9j50dnl3cv9d7w-python3.10-jsonschema-4.17.3 4kr12slm40h9285kx3gqjkc5c4n568y0-python3.10-toml-0.10.2 59h5pjif2nga0hvfpr81i87a840yrgjj-python3.10-tomli-2.0.1 59hsza8nip7zxcqd0rj09qfzaky8n7mq-python3.10-brotlicffi-1.0.9.2 5hy6a7k54z6imlx94g5bpia277xp1dp2-python3.10-PyQt6_WebEngine-6.5.0 6hyv2yddaa60ipkkb3szmlz87pajzn8s-python3.10-dbus-python-1.2.18 7scizi753r035pxcm47yhxlqcc56dwrn-qtbase-6.5.2 843dqq10jdkalr2yazaz6drx334visrb-gcc-12.2.0-lib 8wx1rajzv3r6mw3i6cqday6yy8pp99q9-python3.10-pysocks-1.7.1 90b9hl2nf2zka9vqbyi3q0nynmnmzsfz-python3.10-decorator-5.1.1 90f423nlxl1d5bzmzxvz5rs26gw1xic3-python3.10-attrs-22.2.0 9hspp4km8hx249j9plqfvrfk93gh6asf-python3.10-waitress-2.1.2 9szkk2hqxfm7z7r7yywzqjia6hnlahxg-python3.10-six-1.16.0 ah0kkj68pqxkxd1rmrq8kq2n7n5hy9xq-python3.10-chardet-5.1.0 bc45k1n0pkrdkr3xa6w84w1xhkl1kkyp-python3-3.10.12 bf7mnv9sg0bbxca1wxmr97bblryla8gk-python3.10-pyparsing-3.0.9 c9hbvxlwvaa6rlibmi1vjdldsynbrnxd-python3.10-PyQt6-6.5.2-dev ci5xl870ns88n4zyin528d5ysja7by1x-python3.10-orjson-3.8.11 ckfz7plr3jvxc6sr1rp8l2yslr3n858a-python3.10-pyrsistent-0.19.3 d3d229grcq2dxahww6wj54vqn1db54lc-python3.10-werkzeug-2.2.3 dqp6qzcw3j5b9xpxynk8wp13qz8vwayg-python3.10-markupsafe-2.1.2 f317nybnb1bci4xaxxfdaxkndka36rva-mpv-0.35.1 fizfk41ad8k4qk9wmsi19pnsp5d4ifm5-python3.10-flask-2.2.5 h9j9ff76qk97wi9bg94yx5725bf21dw5-python3.10-cffi-1.15.1 hbhxr093j85i37bz83a2iks0rr8qvv9a-python3.10-babel-2.12.1 hxqf8h7yq8d8nchhkac9lqihdqj9h0ml-python3.10-setuptools-67.4.0 hz23m4gwmd6s527yzp80hq7sbriv4qky-python3.10-beautifulsoup4-4.12.2 j5jnid3a7mpqm7d6wp0wz6jcvj9s60lv-python3.10-brotli-1.0.9 jcq5p6bxqy77d2dvd26aiqxpxad333zz-python3.10-watchdog-3.0.0 jcrh7d3lsw1ycyqjyjynai1bk7y4rx5p-python3.10-Send2Trash-1.8.1b0 la2gha4inb726zrflvif2470br1w3dy2-python3.10-soupsieve-2.4 ll1wm0vjv4irdkrkkkaznhynmcj1ii5s-python3.10-PyQt6_WebEngine-6.5.0-dev m93vs0qkgzgqknspxd0w5b5zrylywk00-python3.10-charset-normalizer-3.0.1 mf7zxz1gfml7wyrxcd7bm1zf5xx2mbng-python3.10-distro-1.8.0 nszxs72adzldd5hmyb9f01xgaxcbd6dl-python3.10-urllib3-1.26.14 nwd2gqcyc69g8044wimjmmd7hcl786w6-python3.10-colorama-0.4.6 p0f08r5grvv02pwvbybzgsdy3jcp4glh-python3.10-requests-2.29.0 p0xyaxqyfr5zz0wh8p45f48via4nja0d-python3.10-PyQt6-6.5.2 qjkdzc8khz7dhb97qfbjj5035rxf25rk-python3.10-zipp-3.15.0 rhl73gdb31445pgd4vjbr0yw6g2ph4bw-qtwayland-6.5.2 s6qx37wlsj7jmna6avpl4ixj853jlg2l-python3.10-Jinja2-3.1.2 vfbsns2ryx3lr09ix3f8d0s46qhmv5ky-python3.10-pycparser-2.21 vjff02f93byza2apr17m4yqcq9rdslvh-python3.10-importlib-metadata-6.0.0 wfcxnnvlgz6kb4q7rj0s7gmqn7syh74g-python3.10-pep517-0.13.0 xa7smbs5z61wx27mhinrg970nf42ymn5-qtdeclarative-6.5.2 y04vpn2yqjl1k5l4915avzh0vviz38dc-lame-3.100 z2ykk8bvjjd45f1dqhq7mmy6qibzz40w-python3.10-click-8.1.3 zpjxj4lw9wkzkf8zl6h408ysv1y80prj-anki-2.1.61
Deriver: i0gczka5s7q8l7q7qgw47l4r0gyvad52-anki-2.1.61.drv
Sig: cache.nixos.org-1:xvqEGX3O/2bVmbSo5oXOUSbvhc0NL7P3lrc7q42ozIcBTYzWBWGevRrvHjjLSf3A8W5tM+Tq9Xnd+SXJvjkvCQ==

If I'm reading the above correctly, this means I'm using Anki 2.1.61 from the NixOS cache.

chewblacka commented 1 year ago

If I'm reading the above correctly, this means I'm using Anki 2.1.61 from the NixOS cache.

Ok I have the same anki installed with the same hashes. Not sure what the issue could be, but it might be related to your particular config. You could try temporarily disabling overlays and or anything else which could possibly be linked?

n-riesco commented 1 year ago

I'm seeing the same crash after, I removed the overlays.

I need to go soon. I'll keep simplifying the config another day.

Are you using Wayland? I'm on Gnome Wayland.

chewblacka commented 1 year ago

Are you using Wayland? I'm on Gnome Wayland.

No I'm still on X11 (pantheon).

n-riesco commented 1 year ago

I've set services.xserver.displayManager.gdm.wayland = false;, logged into Gnome Xorg and I can copy and paste in anki without a crash.

I guess this points towards QtWaylandClient in the stack trace.

I've updated my initial post to make clear this is an issue with anki running under Wayland.