NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
16.68k stars 13.12k forks source link

TETR.IO (PLUS) - "WebGL crashes" when showing tooltips #309293

Closed JuxGD closed 2 months ago

JuxGD commented 2 months ago

Describe the bug

In TETR.IO, whenever I hover over a setting to see what it does (be it in the config menu, custom game settings, etc.), it'll freeze for a bit, and then WebGL crashes. This happens both with and without TETR.IO PLUS. Additionally, when using PLUS, it will also crash inside its settings if I hover over something with a tooltip. This doesn't happen with tetrio_flatpak, so I believe this is specific to the Nix package.

Steps To Reproduce

Steps to reproduce the behavior:

  1. Install tetrio-desktop (from the unstable repo. Tried with nix-shell, in configuration.nix under my user packages, and in my home.nix's home.packages using Home Manager, which is how I have it currently installed)
  2. Open TETR.IO from command line (tetrio), go to config menu for example
  3. Hover over an option with the mouse to see what it does

Expected behavior

I should be able to see what the option changes without any issues.

Screenshots

(videos)

Additional context


### Notify maintainers
- @wackbyte 
- @huantianad 

### Metadata
```console
➜  ~ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 6.6.29, NixOS, 24.05 (Uakari), 24.05pre619660.63c3a29ca824`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.2`
 - channels(root): `"home-manager, nixos"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`

Add a :+1: reaction to issues you find important.

JuxGD commented 2 months ago

New info: installing from the 23.11 repo, which is on TETR.IO v8, works fine. tetrio_flatpak is also on v8 (or that's what it installed for me. I'll see if I can get it to download v9). I'm thinking maybe it could be a v9 problem instead of a problem with the package on the NixOS repos?

I still think it's worth looking into just in case it is. If the issue ends up being TETR.IO v9, I might try to contact osk (TETR.IO dev) about it.

Can anyone outside NixOS try TETR.IO v9 on their machine?

JuxGD commented 2 months ago

New info: I managed to make tetrio_flatpak download and install v9, I tried hovering over something to look at the tooltip and it froze, this time with the black screen right away: https://files.catbox.moe/i3kj21.mp4 (btw when TETR.IO closes I'm doing it with alt+f4, that's me)

????????

I can't try it outside of NixOS, but it looks like TETR.IO v9 itself is the culprit.

(EDIT: I'm gonna open an issue on tetrio/issues in the meantime) (EDIT 2: Here are the release notes for TETR.IO v9 and past versions. With the release, Electron got updated. Might be relevant?)

JuxGD commented 2 months ago

New info: After a laptop suspend (which I'm not sure if is relevant but it still happened), my modified v9 tetrio_flatpak behaves in the same way as the one in the NixOS unstable repo (but slightly faster): https://files.catbox.moe/irtche.mp4 (which, btw, there's the dev console. kinda important)

I set up an Ubuntu 23.03 VM (amd64) to see if it would also happen there with the official TETR.IO v9 .deb and my modified v9 tetrio_flatpak. Both work fine under the VM: https://files.catbox.moe/uqrlpm.mp4

So I think we can conclude that it's NixOS that has problems with TETR.IO v9? I'll keep the issue open

(speaking of tetrio_flatpak i should probably open a pull request there to update to v9, now that we know that it's not broken)
qubitnano commented 2 months ago

I can't reproduce this and I have a similar setup. KDE 6 with wayland. With wayland using NIXOS_OZONE_WL it's super laggy to resize but doesn't crash. I'm just logging in as a guest.

Can you backup $HOME/.config/tetrio-desktop, delete and retry?

JuxGD commented 2 months ago

Done, $HOME/.config/tetrio-desktop got regenerated, I logged in again, no settings changed. The bug is still happening, but by running tetrio with NIXOS_OZONE_WL=true, it's SO laggy but no bug...

Will see if I can get Wayland in my Ubuntu VM and try there, and also try in Plasma X11 (I think I have it) later

JuxGD commented 2 months ago

Also happening on X11. https://files.catbox.moe/0z09ix.mp4

i also tried with NIXOS_OZONE_WL=true for some reason, don't really know why lmao

As it turns out, I was already using Wayland in my Ubuntu VM. Forgot that was the default now. Just to make sure I wasn't missing anything I wanted to try with the "Ubuntu on Xorg" option as well, but it wouldn't let me log into my user. I don't think it's necessary tho

Most definitely a problem with my NixOS config, given the fact that @qubitnano can't reproduce on the same setup. If there's anything specific anyone needs to know about my config, HMU, I'll regularly reload this page.

Is it still worth it opening an issue on tetrio/issues?

JuxGD commented 2 months ago

Tried on Plasma X11 in my Ubuntu VM, no bug.

qubitnano commented 2 months ago

I'm seeing this now on another machine with gnome and an intel igpu.

qubitnano commented 2 months ago

I bisected this to ab14a429cb1a6cc7b7b843a8ad2661ad1570e57c

huantianad commented 2 months ago

Perhaps this is a bug with electron 29? Does this happen with any other electron app?

JuxGD commented 2 months ago

I don't really know any other Electron apps :skull: I'll see what I can find

Is there like, an Electron 29 sample package on nixpkgs or something?

i'll be back in a few hours
huantianad commented 2 months ago

Done, $HOME/.config/tetrio-desktop got regenerated, I logged in again, no settings changed. The bug is still happening, but by running tetrio with NIXOS_OZONE_WL=true, it's SO laggy but no bug...

Will see if I can get Wayland in my Ubuntu VM and try there, and also try in Plasma X11 (I think I have it) later

Also interesting, I'm personally running intel igpu, Wayland KDE, Tetrio with Wayland electron, not having this issue or unbearable performance... in fact performance is better than v8.

Is there also anything relevant in terminal output?

qubitnano commented 2 months ago

Perhaps this is a bug with electron 29? Does this happen with any other electron app?

It's electron 29. 30 doesn't work, and reverting to 28 fixes the crash on one of my machines, and the wayland lag on another.

diff --git a/pkgs/by-name/te/tetrio-desktop/package.nix b/pkgs/by-name/te/tetrio-desktop/package.nix
index f07299b37cc3..9d805c513d05 100644
--- a/pkgs/by-name/te/tetrio-desktop/package.nix
+++ b/pkgs/by-name/te/tetrio-desktop/package.nix
@@ -5,11 +5,15 @@
 , makeWrapper
 , callPackage
 , addOpenGLRunpath
-, electron
+, electron_28
 , withTetrioPlus ? false
 , tetrio-plus ? null
 }:

+let
+  electron = electron_28;
+in
+
 stdenv.mkDerivation (finalAttrs: {
   pname = "tetrio-desktop";
   version = "9.0.0";
huantianad commented 2 months ago

How does electron 30 fail? Just tried it, seems to work fine for me.

qubitnano commented 2 months ago

How does electron 30 fail? Just tried it, seems to work fine for me.

I meant it exhibits the same behavior as 29 but 28 does not.

huantianad commented 2 months ago

Interesting, perhaps this is some electron regression introduced in 29 and not fixed yet in 30. Should we drop back to 28 and report this upstream, either to Tetrio or Electron?

(Maybe it's good to try and reproduce this with some other app to check if it's truly an electron problem, or an issue with some setting tetrio uses.. maybe go into the Tetrio code and try and remove some flags they set to see if anything changes?)

JuxGD commented 2 months ago

Back

Done, $HOME/.config/tetrio-desktop got regenerated, I logged in again, no settings changed. The bug is still happening, but by running tetrio with NIXOS_OZONE_WL=true, it's SO laggy but no bug... Will see if I can get Wayland in my Ubuntu VM and try there, and also try in Plasma X11 (I think I have it) later

Also interesting, I'm personally running intel igpu, Wayland KDE, Tetrio with Wayland electron, not having this issue or unbearable performance... in fact performance is better than v8.

Is there also anything relevant in terminal output?

Almost all the videos I put here have some terminal output, and at least one of them (don't remember if more) had internal console output.

Interesting, perhaps this is some electron regression introduced in 29 and not fixed yet in 30. Should we drop back to 28 and report this upstream, either to Tetrio or Electron?

(Maybe it's good to try and reproduce this with some other app to check if it's truly an electron problem, or an issue with some setting tetrio uses.. maybe go into the Tetrio code and try and remove some flags they set to see if anything changes?)

Not sure how to do that last part

I tested kuro (random package i found using Electron 29). The default Microsoft To-Do UI uses custom tooltips, so I had to open some other page inside, like the privacy policy. There I found a normal tooltip and it didn't freeze or crash.

I'm pretty sure it's a WebGL/TETR.IO thing with Electron, NixOS and X11. Or something in my config. Just as a reminder, the bug also happens with tetrio_flatpak (btw my update PR got merged so it downloads v9 by default now), so I don't think it's a problem with the package from the Nix repos. Could be wrong idk I'm new to NixOS y'all are more qualified than me lol

qubitnano commented 2 months ago

I've narrowed it down on my machine to electron bumping to chromium 122 during electron 29's release.

Test with the following:

mkdir /tmp/tetrio
cd /tmp/tetrio
NIXPKGS_ALLOW_UNFREE=1 nix shell --impure github:nixos/nixpkgs/nixos-unstable#nodejs github:nixos/nixpkgs/nixos-unstable#steam-run
NIXPKGS_ALLOW_UNFREE=1 nix build --impure github:nixos/nixpkgs/nixos-unstable#tetrio-desktop
# Last known good
steam-run npx electron@v29.0.0-alpha.7 ./result/share/TETR.IO/app.asar
# First bad tag
steam-run npx electron@v29.0.0-alpha.8 ./result/share/TETR.IO/app.asar
# This is still present in latest nightly

From https://github.com/electron/electron/compare/v29.0.0-alpha.7...v29.0.0-alpha.8 the most obvious is the chromium 122 import.

The console shows PixiJS 6.1.3 - WebGL 2 so perhaps upgrading to a recent version would help as this version is from 2021.

I've reported this to upstream at https://github.com/tetrio/issues/issues/1268

JuxGD commented 2 months ago

Oh wow, I hadn't seen that issue. Looks like I was wrong about it being specific to NixOS. I guess I'll close this now. Thanks for the help everyone!

JuxGD commented 2 months ago

To be clear to anyone else reading, the problem is still not solved, there's still stuff going on. I just closed because it's not a NixOS issue apparently