flxzt / rnote

Sketch and take handwritten notes.
https://rnote.flxzt.net
GNU General Public License v3.0
8k stars 274 forks source link

Constant crashes when attempting to draw on canvas on new gtk4.14 ngl renderer #1061

Open fotnite-vevo opened 6 months ago

fotnite-vevo commented 6 months ago

Describe the bug
Nearly any action (attempting to draw on the canvas, attempting to move copied in photo) will potentially crash the app, and occasionally crash the entire desktop. Only occurs when running app under Wayland (never crashes under XWayland). Has only been happening since recent upgrade to GNOME 46, most recent rnote version did not have this issue prior.

To Reproduce
Steps to reproduce the behavior:

  1. Attempt to draw on canvas, attempt to move object, etc.

Expected behavior
Rnote doesn't crash

Console Output

2024-03-29T23:05:52.845016Z DEBUG rnote: .. tracing subscriber initialized.
rnote: ../cairo/src/cairo-pattern.c:3831: _cairo_pattern_get_extents: Assertion `status == CAIRO_STATUS_SUCCESS' failed.
fish: Job 1, 'RUST_LOG=rnote=debug RUST_BACKT…' terminated by signal SIGABRT (Abort)

Desktop (please complete the following information):

fotnite-vevo commented 6 months ago

Alright, I did a bit more testing, and it seems to be related to fractional scaling. I usually have fractional scaling set to 1.25x, I still get crashes on 1.5x, but not on 1x, 1.75x, or 2x. but Not sure if it's an upstream bug or not but it seems like it might be.

Doublonmousse commented 6 months ago

Gnome 46 means running on newer gtk (4.14) and libadwaita (1.5) versions.

gtk 4.14 made ngl the default renderer and that seems like the most likely suspect (see https://gitlab.gnome.org/GNOME/gtk/-/issues/?sort=created_date&state=opened&search=ngl&first_page_size=20)

Maybe follow https://gitlab.gnome.org/GNOME/gtk/-/issues/6574#note_2063669 and set GSK_RENDERER=gl or to another renderer to test if ngl is the issue (and report issues upstream to the gtk gitlab).

It will be a while before we can seriously look at gtk 4.14 though (probably need to wait until the new versions are available on all platforms

Once this is available we'll be able to look at gtk 4.14 and related issues (and look back on any previous gtk issues and workarounds)

fotnite-vevo commented 6 months ago

gtk 4.14 made ngl the default renderer and that seems like the most likely suspect (see https://gitlab.gnome.org/GNOME/gtk/-/issues/?sort=created_date&state=opened&search=ngl&first_page_size=20)

Yes, it seems like this is the source of the issue. I'll report this upstream when I have the time to do so.

UnlimitedKaos commented 5 months ago

Maybe follow [..] and set GSK_RENDERER=gl

I also experienced crashes with the arch community package (fwiw Im using Plasma6/Wayland), and this seems to fix it

safizn commented 5 months ago

Experiencing crashes too when drawing. Probably related to fractional scaling as mentioned above.

Crashing version:

   Commit: 25f606dcb4150523065a0167c44f074b31288ae0f40d2cc538c5ecd6c3b7f6c8
   Parent: eeb5736a683913857b95ea5fd2dcd8f4cae1acd65aa375cc879623958c9ce9e4
   Subject: update to v0.10.2 (#54) (5f9c3581)
   Date: 2024-04-06 13:24:35 +0000

Passing version (didn't test versions in-between): This version does not exhibit the crashing issue.

    Commit: dc829353acef99cde736910ca4bafcf6ed4ecdb9623056b0d48e043ef7c4254e
    Subject: update to `v0.9.4` (#48) (ea975b81)
    Date: 2023-12-13 08:51:52 +0000

For anyone looking for a quick fix, install the version that works:

flatpak remote-info --log flathub com.github.flxzt.rnote
flatpak update --commit=dc829353acef99cde736910ca4bafcf6ed4ecdb9623056b0d48e043ef7c4254e com.github.flxzt.rnote
danielwmoore commented 5 months ago

A little extra info, in case it helps.

I'm not using fractional scaling, but am running Ubuntu 24.04 with Gnome 46, and experience the same crashes. Drawing then attempting to zoom or pan often crashes. Drawing and switching to eraser crashes. Takes the entire desktop with it and I have to log back in, having lost any unsaved work in all my apps.

Having the same issue with GIMP crashing when I switch from mouse input to pen input, didn't happen before moving to 24.04 with Gnome 46, so probably the new renderer for sure.

I have not had any crashes with Xournal++ using the pen. rnote and GIMP crash regularly when using the pen. I know, these apps aren't rnote, but I thought it might help in hammering down exactly where the issue is.

Doomsdayrs commented 5 months ago

Adding a bit more info.

This issue will eventually cause the entire gnome-shell to crash as well.

https://retrace.fedoraproject.org/faf/reports/939439/

mbeps commented 5 months ago

Hello, I also have the same issue. Sometimes the entire app crashes but in more sever cases, the entire Gnome Shell crashes. I am currently on Gnome 46 on Fedora 40 using Wayland. The stylus is some sort of Wacom solution used by Dell.

flatpak run com.github.flxzt.rnote
rnote: ../src/cairo-pattern.c:3831: _cairo_pattern_get_extents: Assertion `status == CAIRO_STATUS_SUCCESS' failed.
fotnite-vevo commented 4 months ago

A bit more probing found that this issue does not occur for the Brush tool when path modelling is set to simple. Dragging images can still cause crashes.

fotnite-vevo commented 4 months ago

Hello, I also have the same issue. Sometimes the entire app crashes but in more sever cases, the entire Gnome Shell crashes. I am currently on Gnome 46 on Fedora 40 using Wayland. The stylus is some sort of Wacom solution used by Dell.

flatpak run com.github.flxzt.rnote
rnote: ../src/cairo-pattern.c:3831: _cairo_pattern_get_extents: Assertion `status == CAIRO_STATUS_SUCCESS' failed.

Since you're running the flatpak version, your shell crashes are likely caused by this separate bug in Mutter, which has already been patched upstream but has not yet shipped to distributions.

Doublonmousse commented 3 months ago

I think we should just not use ngl at all on any platforms for the time being.

Force the gl renderer to gl like this https://github.com/Doublonmousse/rnote/commit/215a68e2d76fb44357ea39e2796cba793000a0bf and call it a day.

As the renderer will change to vulkan with the next gtk stable release (4.16) on linux, we can revisit this then (and not lose time searching for nothing).

Other platforms don't have this kind of issues with ngl (this is a ngl linux specific issues) but this renderer also comes with a substantial performance impact so it makes sense to use the old renderer on non linux platforms as well for the time being.

BuonHobo commented 2 months ago

Is it possible to make a new release or at least backport this fix to the flathub version? Unfortunately it's currently unusable for me because I have fractional scaling

fotnite-vevo commented 2 months ago

As the renderer will change to vulkan with the next gtk stable release (4.16) on linux, we can revisit this then (and not lose time searching for nothing).

In light of this, I'd like to point out that on the current flatpak version, the same crash occurs, but with a different console output:

Gsk:ERROR:../gsk/gpu/gskvulkanimage.c:260:gsk_vulkan_image_new: assertion failed: (width > 0 && height > 0)
Bail out! Gsk:ERROR:../gsk/gpu/gskvulkanimage.c:260:gsk_vulkan_image_new: assertion failed: (width > 0 && height > 0)

Which seems on the surface level to be essentially the same bug, but with the Vulkan renderer.

flxzt commented 2 months ago

Rnote v0.11.0, which was just released, forces the renderer to 'gl' in response to the many crash reports posted here.

Eventually this should be re-evaluated at a later date, when Gtk's new renderers become more stable.