Bug 456404

Summary: Autosave interuption while painting
Product: [Applications] krita Reporter: David REVOY <info>
Component: GeneralAssignee: Dmitry Kazakov <dimula73>
Status: RESOLVED FIXED    
Severity: normal CC: halla
Priority: NOR Keywords: regression, release_blocker
Version: nightly build (please specify the git hash!)   
Target Milestone: ---   
Platform: Appimage   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: ^ video of the interuption while painting (13s, 2,9MB, Mp4)

Description David REVOY 2022-07-06 15:53:50 UTC
Created attachment 150445 [details]
^ video of the interuption while painting (13s, 2,9MB, Mp4)

Hi, 

Autosave interupts user while painting. It's a new behavior I observed since first Krita 5.1beta1 but that continues in newer nightlies. It is not present in 5.0.x and spoils the fluidity of painting in Krita. So, it's , in my opinion, an important regression. 

How to reproduce:
===============
You can probably reproduce it with a large document and a big layer stack, an autosave down to 2min interval, and continuously painting. I added a video (13s) that shows for my situation a 3600x5083px srgb8bit document with a layer stack containing a file layer, vector layer, paint layers and groups. It's a page of my comic (censored to remove spoilers) and I'm used to the behavior of Krita with this size, this amount of layer with Krita on this computer. 

Result and Timeline:
=================
The freezing and error message is visible in the attached video, 13seconds in total where the bug happens between 8s to 11s:

- 08s : Autosaving is annonced on the bottom bar while I'm still finishing a paint stroke

- 09s : My brush outline get frozen on a position (over the white frame of the comic) while my cursor start to paint somewhere else (the forehead of Pepper) : it doesn't paint because the outline is still frozen over the white frame.

-09s : the bottom bar switch to the Autosave progress bar with the text "Opening Document 0%" and the terminal immediately prints: "SAFE ASSERT (krita): "clonedDocument->image()->isIdle()" in file /home/appimage/workspace/Krita_Stable_Appimage_Build/krita/libs/ui/KisDocument.cpp, line 1269"

-10s to 11s : My outline catch-up my cursor position, 1second lag or movement frozen in total; the bottom bar now prints "Autosave .... 20%" to "Autosave 100%" to finally announce on the full bottom bar: "Finished autosaving .E37P08.kra-autosave.kra" ; I can paint smoothly during this part of the process. 

This afternoon, I collected more than 40 times this freeze and exact same line on my terminal, It happens frequently.  

Expected:
========
Having autosave happening in background and not freezing painting. 
 
Version and Hardware notes:
========================
Krita Version: 5.1.0-beta2 (git 3672c20)
Qt version compiled: 5.12.12, loaded: 5.12.12.
Fedora 36 KDE. Mesa 
GPU: AMD ATI Radeon RX 5500/5500M / Pro 5500M
CPU: AMD Ryzen 7 3700X (16) @ 3.600GHz
VM: Kwin/X11
DE: KDE Plasma 5.24.5
Comment 1 Dmitry Kazakov 2022-07-08 06:32:29 UTC
Git commit a1e3eff619872b128aa90781e4af5f1beea22147 by Dmitry Kazakov.
Committed on 08/07/2022 at 06:32.
Pushed by dkazakov into branch 'krita/5.1'.

Fix an assert in on document saving that caused freezes on autosaving

The assert caught a real bug in File Layer cloning, and its recovery
branch caused a small freeze. The problem was that I forgot to update
file layer's copy constructor when fixing the lost-files bug.

M  +5    -1    libs/ui/kis_file_layer.cpp

https://invent.kde.org/graphics/krita/commit/a1e3eff619872b128aa90781e4af5f1beea22147
Comment 2 Dmitry Kazakov 2022-07-08 06:32:58 UTC
Git commit f084463b24c80f09c709de0a83f8b05fb125aff8 by Dmitry Kazakov.
Committed on 08/07/2022 at 06:32.
Pushed by dkazakov into branch 'master'.

Fix an assert in on document saving that caused freezes on autosaving

The assert caught a real bug in File Layer cloning, and its recovery
branch caused a small freeze. The problem was that I forgot to update
file layer's copy constructor when fixing the lost-files bug.

M  +5    -1    libs/ui/kis_file_layer.cpp

https://invent.kde.org/graphics/krita/commit/f084463b24c80f09c709de0a83f8b05fb125aff8
Comment 3 Dmitry Kazakov 2022-07-08 06:35:00 UTC
Hi, David!

I have also triggered the stable nightly builds with the fix for you to test. This build should include the fix:

https://binary-factory.kde.org/job/Krita_Stable_Appimage_Build/