Bug 421518 - Frequent Crash when creating a second new file of size 2048 x 2048 or greater
Summary: Frequent Crash when creating a second new file of size 2048 x 2048 or greater
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Usability (show other bugs)
Version: 4.3.0-beta1
Platform: Debian stable Linux
: NOR crash
Target Milestone: ---
Assignee: Dmitry Kazakov
URL:
Keywords:
: 422114 (view as bug list)
Depends on:
Blocks:
 
Reported: 2020-05-14 16:30 UTC by Ahab Greybeard
Modified: 2020-06-02 09:44 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Desktop and laptop logs - 4.3.0-beta2 (git e2b62dc) (3.57 KB, application/zip)
2020-05-29 15:47 UTC, Ahab Greybeard
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ahab Greybeard 2020-05-14 16:30:19 UTC
SUMMARY
This happens with the 'standard' 4.3.0 beta-1 appimage and also the May-13 4.3.0 Nightly git 0161f7d appimage.
It does not happen with the Windows .zip packages.
It does not happen with 4.2.9

STEPS TO REPRODUCE
1. I used fresh configurations and resources in case there was something 'strange' in there.
2. Run krita and make a new file of size 2048 x 2048 or larger.
3. Make another new file of 2048 x 2048 or larger.

OBSERVED RESULT
Shut down and vanish about 9/10 times.

================================================================================
SESSION: 14 May 2020 17:01:20 +0100. Executing /home/adminahab/FWORK/Downloads/krita-4.3.0-beta1

Krita Version: 4.3.0-beta1, Qt version compiled: 5.12.8, loaded: 5.12.8. Process ID: 3926
-- -- -- -- -- -- -- --
14 May 2020 17:01:38 +0100: Created image "Unnamed", 3000 * 3000 pixels, 100 dpi. Color model: 8-bit integer/channel RGB/Alpha (sRGB-elle-V2-srgbtrc.icc). Layers: 2
14 May 2020 17:01:44 +0100: Created image "Unnamed", 3000 * 3000 pixels, 100 dpi. Color model: 8-bit integer/channel RGB/Alpha (sRGB-elle-V2-srgbtrc.icc). Layers: 2
14 May 2020 17:01:44 +0100: ASSERT (krita): "d->canvas == canvas" in file /home/appimage/workspace/Krita_Release_Appimage_Build/krita/libs/ui/input/kis_input_manager_p.cpp, line 239

KRITA DID NOT CLOSE CORRECTLY
===============================================================================

If a 1024 x 1024 image is created at first, then a second new file of 2048 x 2048 will not give a crash. After this, any deleting and creating of new files will not crash, generally.
If a 2028 x 2048 image is created first and then a 1024 x 1024 inage is created, it will not crash and after this will not crash after any deleting and creating of new files.
On one occassion, it crashed after a restart when I created the first new file of 2048 x 2048.

EXPECTED RESULT
A new tab/image should be created with no problems at all sizes.

SOFTWARE/OS VERSIONS
Krita

 Version: 4.3.0-beta1
 Languages: en_GB, en, en, en_GB, en
 Hidpi: true

Qt

  Version (compiled): 5.12.8
  Version (loaded): 5.12.8

OS Information

  Build ABI: x86_64-little_endian-lp64
  Build CPU: x86_64
  CPU: x86_64
  Kernel Type: linux
  Kernel Version: 4.19.0-8-amd64
  Pretty Productname: Debian GNU/Linux 10 (buster)
  Product Type: debian
  Product Version: 10
  Desktop: MATE

OpenGL Info
 
  Vendor:  "NVIDIA Corporation" 
  Renderer:  "GeForce GTX 750 Ti/PCIe/SSE2" 
  Version:  "4.6.0 NVIDIA 440.82" 
  Shading language:  "4.60 NVIDIA" 
  Requested format:  QSurfaceFormat(version 3.0, options QFlags<QSurfaceFormat::FormatOption>(DeprecatedFunctions), depthBufferSize 24, redBufferSize 8, greenBufferSize 8, blueBufferSize 8, alphaBufferSize 8, stencilBufferSize 8, samples -1, swapBehavior QSurfaceFormat::DoubleBuffer, swapInterval 0, colorSpace QSurfaceFormat::DefaultColorSpace, profile  QSurfaceFormat::CompatibilityProfile) 
  Current format:    QSurfaceFormat(version 4.6, options QFlags<QSurfaceFormat::FormatOption>(DeprecatedFunctions), depthBufferSize 24, redBufferSize 8, greenBufferSize 8, blueBufferSize 8, alphaBufferSize 8, stencilBufferSize 8, samples -1, swapBehavior QSurfaceFormat::DoubleBuffer, swapInterval 0, colorSpace QSurfaceFormat::DefaultColorSpace, profile  QSurfaceFormat::CompatibilityProfile) 
     Version: 4.6
     Supports deprecated functions true 
     is OpenGL ES: false 

QPA OpenGL Detection Info 
  supportsDesktopGL: true 
  supportsOpenGLES: true 
  isQtPreferOpenGLES: false 

Hardware Information

  GPU Acceleration: auto
  Memory: 16039 Mb
  Number of Cores: 8
  Swap Location: /tmp

Current Settings

  Current Swap Location: /tmp
  Current Swap Location writable: true
  Undo Enabled: true
  Undo Stack Limit: 30
  Use OpenGL: true
  Use OpenGL Texture Buffer: true
  Use AMD Vectorization Workaround: false
  Canvas State: OPENGL_SUCCESS
  Autosave Interval: 900
  Use Backup Files: true
  Number of Backups Kept: 1
  Backup File Suffix: ~
  Backup Location: Same Folder as the File
  Backup Location writable: false
  Use Win8 Pointer Input: false
  Use RightMiddleTabletButton Workaround: false
  Levels of Detail Enabled: true
  Use Zip64: false

Display Information
Number of screens: 2
	Screen: 0
		Name: DVI-D-1
		Depth: 24
		Scale: 1
		Resolution in pixels: 1280x1024
		Manufacturer: Dell Inc.
		Model: DELL 1704FPV-
		Refresh Rate: 60
	Screen: 1
		Name: DVI-D-0
		Depth: 24
		Scale: 1
		Resolution in pixels: 1280x1024
		Manufacturer: Dell Inc.
		Model: DELL 1704FPV-
		Refresh Rate: 75

ADDITIONAL INFORMATION

A RARE GOOD ONE:
================================================================================
SESSION: 14 May 2020 17:11:23 +0100. Executing /home/adminahab/FWORK/Downloads/krita-4.3.0-beta1

Krita Version: 4.3.0-beta1, Qt version compiled: 5.12.8, loaded: 5.12.8. Process ID: 4490
-- -- -- -- -- -- -- --
14 May 2020 17:11:42 +0100: Created image "Unnamed", 2048 * 2048 pixels, 100 dpi. Color model: 8-bit integer/channel RGB/Alpha (sRGB-elle-V2-srgbtrc.icc). Layers: 2
14 May 2020 17:11:47 +0100: Created image "Unnamed", 2048 * 2048 pixels, 100 dpi. Color model: 8-bit integer/channel RGB/Alpha (sRGB-elle-V2-srgbtrc.icc). Layers: 2
14 May 2020 17:11:58 +0100: CLOSING SESSION
================================================================================

THE USUAL BAD ONE:
================================================================================
SESSION: 14 May 2020 17:12:00 +0100. Executing /home/adminahab/FWORK/Downloads/krita-4.3.0-beta1

Krita Version: 4.3.0-beta1, Qt version compiled: 5.12.8, loaded: 5.12.8. Process ID: 4609
-- -- -- -- -- -- -- --
14 May 2020 17:12:11 +0100: Created image "Unnamed", 2048 * 2048 pixels, 100 dpi. Color model: 8-bit integer/channel RGB/Alpha (sRGB-elle-V2-srgbtrc.icc). Layers: 2
14 May 2020 17:12:16 +0100: Created image "Unnamed", 2048 * 2048 pixels, 100 dpi. Color model: 8-bit integer/channel RGB/Alpha (sRGB-elle-V2-srgbtrc.icc). Layers: 2
14 May 2020 17:12:16 +0100: ASSERT (krita): "d->canvas == canvas" in file /home/appimage/workspace/Krita_Release_Appimage_Build/krita/libs/ui/input/kis_input_manager_p.cpp, line 239

KRITA DID NOT CLOSE CORRECTLY
================================================================================
Comment 1 Halla Rempt 2020-05-15 09:52:46 UTC
I can confirm with the appimage, though not with my local build. But that assert is a safe assert, so it shouldn't even close krita: https://invent.kde.org/kde/krita/-/merge_requests/338

As for why the assert happens, I'll ask dmitry to look at this bug.
Comment 2 Dmitry Kazakov 2020-05-26 20:50:42 UTC
*** Bug 422114 has been marked as a duplicate of this bug. ***
Comment 3 Dmitry Kazakov 2020-05-29 11:54:21 UTC
Well, I cannot reproduce this crash. Neither on Windows nor on Linux (neither in home-built 4.3 nor in 4.3 beta appimage) :(
Comment 4 Dmitry Kazakov 2020-05-29 14:16:45 UTC
Hi, Ahab!

Could you please check this AppImage and provide me the terminal output of it?
https://yadi.sk/d/L12GXqThVTx7Gw

It might give me more info for the crash :)
Comment 5 Dmitry Kazakov 2020-05-29 15:11:56 UTC
Git commit 5aef0e99a7b64a8cdb6970803e9c080d47e918e6 by Dmitry Kazakov.
Committed on 29/05/2020 at 15:11.
Pushed by dkazakov into branch 'master'.

Make sanity check in CanvasSwitcher less strict

I couldn't reproduce the crash, but the mechanics happens like that:

1) KisCanvas2::setCanvasWidget() adds the canvas to the list of the
   tracked ones and continues loading process.

2) Some other canvas gets activated by spontaneous SetFocus event
   (Note: I haven't managed to reproduce that!)

3) KisMainWindow::addView() registers the canvas at the input manager
   again. But since some other canvas has been activated by a spontaneous
   event, d->canvas is not equal to canvas anymore.

Possible solutions:

Option A:
Remove double registration of the canvas in the input manager and do
it only once either in KisCanvas::setCanvasWidget() or in KisMainWindow

Option B:
Justremove the sanity check. But this way we may miss real bugs that
may happen because of double initialization of the canvas.

M  +7    -2    libs/ui/input/kis_input_manager_p.cpp

https://invent.kde.org/graphics/krita/commit/5aef0e99a7b64a8cdb6970803e9c080d47e918e6
Comment 6 Dmitry Kazakov 2020-05-29 15:11:56 UTC
Git commit e09e59548481b32f025c64f9b322bd28ab6ddc9e by Dmitry Kazakov.
Committed on 29/05/2020 at 15:11.
Pushed by dkazakov into branch 'master'.

Remove double initialization of the inut manager on image creation

The initialization in KisCanvas2::setCanvasWidget() was intended only
for the case when the canvas type is switched (opengl<->qpainter) and
it shouldn't trigger during normal canvas creation process.

This patch is too dangerous for 4.3.0 release, it should be pushed into
4.3 branch only for 4.3.1 release.

M  +14   -10   libs/ui/canvas/kis_canvas2.cpp

https://invent.kde.org/graphics/krita/commit/e09e59548481b32f025c64f9b322bd28ab6ddc9e
Comment 7 Dmitry Kazakov 2020-05-29 15:12:55 UTC
Git commit 4f2ceb136cbf90536d3435174359e61db4e28351 by Dmitry Kazakov.
Committed on 29/05/2020 at 15:12.
Pushed by dkazakov into branch 'krita/4.3'.

Make sanity check in CanvasSwitcher less strict

I couldn't reproduce the crash, but the mechanics happens like that:

1) KisCanvas2::setCanvasWidget() adds the canvas to the list of the
   tracked ones and continues loading process.

2) Some other canvas gets activated by spontaneous SetFocus event
   (Note: I haven't managed to reproduce that!)

3) KisMainWindow::addView() registers the canvas at the input manager
   again. But since some other canvas has been activated by a spontaneous
   event, d->canvas is not equal to canvas anymore.

Possible solutions:

Option A:
Remove double registration of the canvas in the input manager and do
it only once either in KisCanvas::setCanvasWidget() or in KisMainWindow

Option B:
Justremove the sanity check. But this way we may miss real bugs that
may happen because of double initialization of the canvas.

M  +7    -2    libs/ui/input/kis_input_manager_p.cpp

https://invent.kde.org/graphics/krita/commit/4f2ceb136cbf90536d3435174359e61db4e28351
Comment 8 Dmitry Kazakov 2020-05-29 15:14:39 UTC
Hi, Ahab!

The bug should be fixed now, but I would still like to know the actual mechanics of it. Could you still send me the output of the package I shared above?

https://bugs.kde.org/show_bug.cgi?id=421518#c4
Comment 9 Ahab Greybeard 2020-05-29 15:47:56 UTC
Created attachment 128909 [details]
Desktop and laptop logs - 4.3.0-beta2 (git e2b62dc)

Hi Dmitry,

I've attached the terminal output and also the logs, including logs from my laptop.

The laptop is at the same Debian 10 full update state (i.e today) as the desktop PC.
However, the laptop can handle two new A4(300 ppi) documents but gives a Safe Assert for two 4096 x 4096 documents.
The desktop gives Safe Assert (non crash, can be Ignored) for two new A4(300 ppi) documents.
The only obvious difference is the graphics components and I include the laptop system info log.

Now, the desktop gives a Safe Assert on alternate new A4(300 ppi) documents.
Comment 10 Dmitry Kazakov 2020-05-29 17:58:08 UTC
Hi, Ahab!

What desktop environment you use? And do you click on the "Create" button with a mouse or with a tablet?

It looks like the your desktop environment generates a different flow of events, so I cannot reproduce it :)

I'll make one more package for you now.
Comment 11 Ahab Greybeard 2020-05-29 18:20:51 UTC
Hi Dmitry,

My desktop environment is MATE 1.20.4 and I used a mouse for everything.

Are you interested in the laptop behaviour or should I just concentrate on my PC?
Comment 12 Dmitry Kazakov 2020-05-29 19:09:32 UTC
Hi, Ahab!

Could you check if you have the assert in this AppImage:
https://yadi.sk/d/-04NVuxnGN6q7Q

Does it fix the assert?

I have pushed the fix to 5.0, but I will not push it to 4.3.0, because it is a little dangerous. I'll merge it right after the release.
Comment 13 Ahab Greybeard 2020-05-29 20:14:36 UTC
Hi Dmitry,

With the (git a0ed0b7) appimage, I see no asserts even if I create six A3(600 dpi) images.

On saving and on opening four 4096 x 4096 images, I see terminal messages of the type:
qt.qpa.xcb: QXcbConnection: XCB error: 3 (BadWindow), sequence: 3066, resource id: 12630685, major code: 40 (TranslateCoords), minor code: 0

The sequence and resource id are different every time.

I've no idea what those messages mean but it's now creating, saving and opening with no apparent problems - thank you :)
Comment 14 Dmitry Kazakov 2020-05-29 20:31:42 UTC
XCB warnings are unrelated, and they seem to be harmless :)

Then it looks like the bug is fixed, though the fix will be only in 4.3.1 ;)
Comment 15 Dmitry Kazakov 2020-06-02 09:44:37 UTC
Git commit 8e8303429030004a1cbe262945e653515eef3a78 by Dmitry Kazakov.
Committed on 02/06/2020 at 09:34.
Pushed by dkazakov into branch 'krita/4.3'.

Remove double initialization of the inut manager on image creation

The initialization in KisCanvas2::setCanvasWidget() was intended only
for the case when the canvas type is switched (opengl<->qpainter) and
it shouldn't trigger during normal canvas creation process.

This patch is too dangerous for 4.3.0 release, it should be pushed into
4.3 branch only for 4.3.1 release.

M  +14   -10   libs/ui/canvas/kis_canvas2.cpp

https://invent.kde.org/graphics/krita/commit/8e8303429030004a1cbe262945e653515eef3a78