sanderland / katrain

Improve your Baduk skills by training with KataGo!
Other
1.58k stars 223 forks source link

katrain freezes when making a play #691

Open sagehane opened 2 months ago

sagehane commented 2 months ago

Setup

$ nix-info -m
 - system: `"x86_64-linux"`
 - host os: `Linux 6.6.31, NixOS, 24.11 (Vicuna), 24.11.20240618.c00d587`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.2`
 - channels(root): `"nixos"`
 - nixpkgs: `/nix/store/pfqbxdicyksnqda6h5xv285sx7vamwzd-source

On NixOS Unstable with katrain built from the following source:

{ python3Packages }:
with python3Packages;

let
  ffpyplayer = buildPythonPackage rec {
    pname = "ffpyplayer";
    version = "4.5.1";

    src = fetchPypi {
      inherit pname;
      inherit version;
      hash = "sha256-1V1UVj/PbDNFBbRdS2SCXyT6+1rPp6nkcsCOh39UkGk=";
    };

    nativeBuildInputs = with pkgs; [
      cython_0
      pkg-config
      pytest

    ];

    buildInputs = with pkgs; [
      SDL2
      ffmpeg-headless
    ];
  };

  # https://github.com/sanderland/katrain/issues/445
  kivymd = buildPythonPackage rec {
    pname = "kivymd";
    version = "0.104.1";

    src = fetchPypi {
      inherit pname;
      inherit version;
      hash = "sha256-ncvCy4r/3pyCVyGY/dsyyBTN1XJUoOSwDFOILbLI1qY=";
    };

    nativeBuildInputs = [
      #docutils
    ];

    propagatedBuildInputs = [ kivy ];

    doCheck = false;
  };
in
buildPythonPackage rec {
  pname = "KaTrain";
  version = "1.14.0";

  src = fetchPypi {
    inherit pname;
    inherit version;
    hash = "sha256-gMZ8b3oB/WReaK6aN7yLU+ZegGHi/sJpgvshXuxqcf4=";
  };

  nativeBuildInputs = [
    #docutils
  ];

  # Seems to be an optional runtime dependency
  buildInputs = [
    # wl-clipboard-x11

    # xclip
    # xsel
  ];

  # https://github.com/sanderland/katrain/blob/v1.14.0/setup.py
  propagatedBuildInputs = [
    chardet
    screeninfo
    setuptools
    urllib3

    ffpyplayer
    kivymd
  ];

  doCheck = false;
}

I use a wlroots-based Wayland window manager called River, with XWayland enabled.

Current Behaviour

The program consistently freezes immediately after making a play, with no error messages. It becomes completely unresponsive and uses a lot of CPU resources.

strace reveals that the following futex calls are being spammed after the freeze:

futex(0x7f2d137bf310, FUTEX_WAIT_BITSET_PRIVATE, 0, {tv_sec=6134, tv_nsec=405410057}, FUTEX_BITSET_MATCH_ANY) = -1 ETIMEDOUT (Connection timed out)
futex(0x7f2d137bf318, FUTEX_WAKE_PRIVATE, 1) = 0
sagehane commented 2 months ago

I'm also getting a crash with an expression generated by https://github.com/nix-community/pip2nix, so I'm suspecting it might be an issue with window manager setup or similar...