Bug report #15754

editing several layers in geopackage - database is locked

Added by Jochen Huber over 7 years ago. Updated over 6 years ago.

Category:Data Provider/OGR
Affected QGIS version:2.18.0 Regression?:No
Operating System:Windows Easy fix?:No
Pull Request or Patch supplied:No Resolution:fixed/implemented
Crashes QGIS or corrupts data:No Copied to github as #:23676


In a QGIS project with several layers from a single geopackage database, the following problem frequently occurs:
Switch layer to editing mode, do geometry edits, save edits, deactivate layer editing mode.
Switch second layer to editing mode, do geometry edits, try to save edits -> Database provider errors (OGR) e.g. "failed to execute insert: database is locked".
After closing QGIS and reopening the same project, the second layer can be edited and the edits are successfully saved, but the problem occurs again when another layer from the same geopackage is edited.
Maybe this problem is related to the one in #15351.

test.gpkg (65 KB) Even Rouault, 2016-12-21 09:39 AM


#1 Updated by Even Rouault about 7 years ago

I tried with master on Linux with the attached DB and couldn't reproduce the issue (I'm attaching the simple DB I used for reference). Normally locking issues should have been fixed in 2.18.0 per #0497e4a454c7ad689a0fc7b767208f95d53266b0. Can you have provide a reproducable procedure + test DB ?

#2 Updated by Jochen Huber about 7 years ago

I tried again with the sample DB you supplied and still experienced the same problem. Open QGIS, create a new project, add all layers from the DB, edit the geometry of one layer and save, edit the geometry of the second layer -> saving fails.
A test with the DB located on a local drive did NOT show the problem, prompting further investigation:
  • Network share on Windows Server 2008 R2 Standard, Access via domain-integrated DFS (Distributed File System): Problem occurs
  • Network share on Windows Server 2008 R2 Standard, direct access to server: Works fine
  • Network share on Windows Server 2012 R2 Standard (direct access), Windows 7 Professional SP 1, QNAP NAS or Western Digital MyBook Live: Works fine

So this seems to be a problem which only occurs when accessing a network share via DFS (which is the standard case in our company). Interestingly, there is no problem with Spatialite DBs, so there seems to be a difference in how QGIS accesses Geopackage DBs vs. Spatialite DBs.

#3 Updated by Jérôme Guélat about 7 years ago

We are also experiencing this problem with QGIS 2.18.3 (OGR/GDAL 2.1.3) on Windows.

#4 Updated by Ger CO about 7 years ago

Same here on Win 7 and qgis 2.18.3

#5 Updated by Giovanni Manghi almost 7 years ago

  • Easy fix? set to No
  • Regression? set to No

#6 Updated by Even Rouault over 6 years ago

  • Description updated (diff)
  • Status changed from Open to Feedback

Can anyone retry with QGIS master ? Changes done in 8f3d44d4e9321efc035a6080b161f5dd48d4f230 should likely fix that

#7 Updated by Jochen Huber over 6 years ago

I tried with QGIS master (2.99.0, code version af5b2a750a) and also on 2.18.14. I didn't experience the problem any more on both versions (not only on master).

#8 Updated by Giovanni Manghi over 6 years ago

  • Status changed from Feedback to Closed
  • Resolution set to fixed/implemented

Also available in: Atom PDF