# The database lock

**URL:** <https://gramps.discourse.group/t/the-database-lock/9652>\
**Category:** Help\
**Created:** [June 23, 2026, 12:10pm UTC](https://gramps.discourse.group/t/the-database-lock/9652 "2026-06-23T12:10:39Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Altair](https://avatars.discourse-cdn.com/v4/letter/a/dbc845/32.png) [@Altair](https://gramps.discourse.group/u/Altair)\
**Post date:** [June 23, 2026, 12:10pm UTC](https://gramps.discourse.group/t/the-database-lock/9652/1 "2026-06-23T12:10:39Z")

</div>

Gramps version 6 and using a Mac.

Since going on the forum - which answered my question - I now get the message, ‘Break lock on the ‘Sykes’ database? Gramps believes someone else is actively editing your database. You cannot edit the database while it is locked. If no-one is editing this database you may safely break the lock. However if someone else is editing the database, and you break the lock, you may corrupt the database”. THIS IS ILLOGICAL. If someone else was editing it the lock must be switched off or inoperative, otherwise they would not be able to edit it. As things stand today the dashboard comes up but without the data. This did not happen last time I used it. Any suggestions (I haven’t broken the lock yet) ?

---

<div class="post-metadata">

**Author:** ![Davesellers](https://yyz2.discourse-cdn.com/free1/user_avatar/gramps.discourse.group/davesellers/32/1457_2.png) [@Davesellers](https://gramps.discourse.group/u/Davesellers)\
**Post date:** [June 23, 2026, 1:03pm UTC](https://gramps.discourse.group/t/the-database-lock/9652/2 "2026-06-23T13:03:47Z")

</div>

Gramps is designed to be a single user system. This condition happens when gramps is not shut down properly. Example: you killed gramps by turning off your Mac.

You just need to break the lock and then you can load your database.

---

<div class="post-metadata">

**Author:** ![jacrider](https://avatars.discourse-cdn.com/v4/letter/j/b5a626/32.png) [@jacrider](https://gramps.discourse.group/u/jacrider)\
**Post date:** [June 23, 2026, 1:28pm UTC](https://gramps.discourse.group/t/the-database-lock/9652/3 "2026-06-23T13:28:54Z")

</div>

You are not understanding the terminology. Like many editing programs,  
when one person has a database or document open, the program creates a  
lock that says no one else may open it until it has been closed. But if  
the program is not properly shutdown or crashes due to an error, the  
lock will remain in place and must be broken before the document or  
database can be accessed again after the program is restarted. This  
applies to many programs such as LibreOffice, not just Gramps.

---

<div class="post-metadata">

**Author:** ![csam](https://yyz2.discourse-cdn.com/free1/user_avatar/gramps.discourse.group/csam/32/5361_2.png) [@csam](https://gramps.discourse.group/u/csam)\
**Post date:** [June 23, 2026, 1:32pm UTC](https://gramps.discourse.group/t/the-database-lock/9652/4 "2026-06-23T13:32:11Z")

</div>

Maybe we should consider a better way to lock the database. Creating a ‘lock’ file doesn’t lock the database from a RDBMS point of view - it just prevent Gramps connecting.

Yesterday I connected to the database using ‘DB Browser for SQLite’ while Gramps was running. In DB Browser I created a number of virtual indexes. Then still while DB Browser was connected, I made an update in Gramps and got a ‘Database locked error’. I disconnected from DB Browser, and then the Gramps update worked.

SQLite connection supports both ‘isolation\_level’ and ‘check\_same\_thred’ for handling this.

---

<div class="post-metadata">

**Author:** ![dsblank](https://yyz2.discourse-cdn.com/free1/user_avatar/gramps.discourse.group/dsblank/32/3649_2.png) [@dsblank](https://gramps.discourse.group/u/dsblank)\
**Post date:** [June 23, 2026, 2:21pm UTC](https://gramps.discourse.group/t/the-database-lock/9652/5 "2026-06-23T14:21:18Z")

</div>

Yes, the lock was a quick and dirty step away from BSDDB. @Nick-Hall mentioned that he had ideas about removing it.

---

<div class="post-metadata">

**Author:** ![Nick-Hall](https://yyz2.discourse-cdn.com/free1/user_avatar/gramps.discourse.group/nick-hall/32/95_2.png) [@Nick-Hall](https://gramps.discourse.group/u/Nick-Hall)\
**Post date:** [June 23, 2026, 2:39pm UTC](https://gramps.discourse.group/t/the-database-lock/9652/6 "2026-06-23T14:39:24Z")

</div>

We have a medium-term goal of allowing concurrent access to Gramps. This would enable us to remove the lock file, which would be nice as it often causes confusion.

It would require 3 changes:

1. Remove metadata caching. At present, this also causes data loss when Gramps crashes.
2. Avoid editors writing snapshots of objects. I already have a prototype which writes a JSON patch instead.
3. Move the undo database into the backend.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/gramps/original/1X/2ac1e712b7adf612e31ca08a55419f4cf37c0158.png) [@system](https://gramps.discourse.group/u/system)\
**Post date:** [July 23, 2026, 2:40pm UTC](https://gramps.discourse.group/t/the-database-lock/9652/7 "2026-07-23T14:40:20Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
