MerginMaps / MerginMaps/qgis-plugin

Plugin database is locked error

Open
#473 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
44
Forks
20
Avg merge
3d 12h
Merged PRs (30d)
5

Description

During testing of input on phone with full storage, this error appears in plugin.
Probably input removes some data or packages, and plugin didn't like it ;)

An error has occurred while executing Python code: 

sqlite3.OperationalError: database is locked 
Traceback (most recent call last):
  File "/home/jozef/.local/share/QGIS/QGIS3/profiles/prof1/python/plugins/Mergin/plugin.py", line 390, in current_project_sync
    self.manager.project_status(self.mergin_proj_dir)
  File "/home/jozef/.local/share/QGIS/QGIS3/profiles/prof1/python/plugins/Mergin/projects_manager.py", line 168, in project_status
    pull_changes, push_changes, push_changes_summary = self.mc.project_status(project_dir)
  File "/home/jozef/.local/share/QGIS/QGIS3/profiles/prof1/python/plugins/Mergin/mergin/client.py", line 779, in project_status
    push_changes = mp.get_push_changes()
  File "/home/jozef/.local/share/QGIS/QGIS3/profiles/prof1/python/plugins/Mergin/mergin/merginproject.py", line 327, in get_push_changes
    size, checksum = do_sqlite_checkpoint(self.fpath(file["path"]), self.log)
  File "/home/jozef/.local/share/QGIS/QGIS3/profiles/prof1/python/plugins/Mergin/mergin/utils.py", line 92, in do_sqlite_checkpoint
    cursor.execute("PRAGMA wal_checkpoint=FULL")
sqlite3.OperationalError: database is locked


Python version: 3.10.6 (main, Nov  2 2022, 18:53:38) [GCC 11.3.0] 
QGIS version: 3.22.13-Białowieża Białowieża, 02ff117c4e 

Python Path:
/usr/share/qgis/python
/home/jozef/.local/share/QGIS/QGIS3/profiles/prof1/python
/home/jozef/.local/share/QGIS/QGIS3/profiles/prof1/python/plugins
/usr/share/qgis/python/plugins
/usr/lib/python310.zip
/usr/lib/python3.10
/usr/lib/python3.10/lib-dynload
/home/jozef/.local/lib/python3.10/site-packages
/usr/local/lib/python3.10/dist-packages
/usr/lib/python3/dist-packages
/home/jozef/.local/share/QGIS/QGIS3/profiles/prof1/python
.
/home/jozef/Lutra/projects/b/Aaa

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with mergin/utils.py at do_sqlite_checkpoint and trace its call from mergin/merginproject.py:get_push_changes, then review the plugin.py and projects_manager.py stack frames. Reproduce the reported full-storage phone scenario if possible and confirm that project status no longer raises sqlite3.OperationalError: database is locked.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, sqlite
Domain
databases, desktop
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.