Bug 420078 - Krita tries to use not open database in a specific case
Summary: Krita tries to use not open database in a specific case
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Resource Management (other bugs)
Version First Reported In: git master (please specify the git hash!)
Platform: Mint (Ubuntu based) Linux
: NOR normal
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-04-14 12:42 UTC by Tiar
Modified: 2020-04-15 09:30 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tiar 2020-04-14 12:42:23 UTC
SUMMARY
When in one-instance mode, opening another instance of Krita will result in destructor calling database functions that don't work because the database hasn't been open.


STEPS TO REPRODUCE
1. Make sure you have multiple instances of Krita disabled (it's like that by default)
2. Open Krita.
3. Open Krita again from console.

OBSERVED RESULT
A log that complains about errors with database due to "driver not loaded". (Note: from a developer point of view, it looks like a problem with SQL, especially now that there were a lot of weird issues...)


EXPECTED RESULT
No errors from the database (possibly a debug line "Krita closes because of multiple instances not being allowed").

SOFTWARE/OS VERSIONS
Krita

 Version: 5.0.0-prealpha (git dde4967) (3145ca0914 on master, last hash is my local)
 Languages: pl, pl_PL, pl
 Hidpi: true

Qt

  Version (compiled): 5.11.1
  Version (loaded): 5.11.1

OS Information

  Build ABI: x86_64-little_endian-lp64
  Build CPU: x86_64
  CPU: x86_64
  Kernel Type: linux
  Kernel Version: 5.3.7-050307-generic
  Pretty Productname: Linux Mint 19.3
  Product Type: linuxmint
  Product Version: 19.3
  Desktop: X-Cinnamon
Comment 1 Halla Rempt 2020-04-14 12:45:19 UTC
We'll have to disable multi-process mode completely to solve this, or use something like mysql/mariadb which allows concurrent database access (with all the hairy problems that will give us.)
Comment 2 Tiar 2020-04-14 13:43:29 UTC
We can just return from the function ("remove temporary something") if the database is not open, can't we?
Comment 3 Halla Rempt 2020-04-14 13:47:38 UTC
If we cannot open the database, we can do nothing...
Comment 4 Tiar 2020-04-14 15:52:24 UTC
Exactly, but now in the single-instance mode, if Krita sees that another instance of Krita is already open, then it closes, calls the destructor, and the destructor tries to remove stuff from a database that wasn't open because, most probably, the opening calls are further down than checking whether we should close Krita early. So either in destructor or in the removeTemporary... call itself it should check if the database it tries to operate on is open and valid.
Comment 5 Halla Rempt 2020-04-15 09:30:13 UTC
Git commit 0ddaf9ffefc4433ac11f3c40498ff088d7d1edd3 by Boudewijn Rempt.
Committed on 15/04/2020 at 08:51.
Pushed by rempt into branch 'master'.

Remove the option to run krita in multiple processes

This is not compatible with using a database like sqlite, which
doesn't allow concurrent access. Besides, changing the contents
of the database from two krita processes would lead to massive
confusion.

M  +1    -4    krita/main.cc
M  +1    -4    libs/ui/dialogs/kis_dlg_preferences.cc
M  +7    -27   libs/ui/forms/wdggeneralsettings.ui

https://invent.kde.org/kde/krita/commit/0ddaf9ffefc4433ac11f3c40498ff088d7d1edd3