# Database Is Locked

**URL:** <https://community.getmailspring.com/t/database-is-locked/420>\
**Category:** Bug Reports\
**Tags:** next, accepted, stability\
**Created:** [February 1, 2021, 7:22pm UTC](https://community.getmailspring.com/t/database-is-locked/420 "2021-02-01T19:22:10Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![CodeMouse92](https://community.getmailspring.com/user_avatar/community.getmailspring.com/codemouse92/32/2359_2.png) [@CodeMouse92](https://community.getmailspring.com/u/CodeMouse92)\
**Post date:** [February 1, 2021, 7:22pm UTC](https://community.getmailspring.com/t/database-is-locked/420/1 "2021-02-01T19:22:10Z")

</div>

Multiple users are reporting the database becoming locked, forcing them to regularly clear the Mailspring cache to resolve it. (For some, removing the cache does not resolve it.)

According to **[tristanlins](https://github.com/tristanlins)** on GitHub, this issue first appeared in 1.6.1. (See migrated comment below.)

> <https://github.com/Foundry376/Mailspring/issues/595>
>
> I get the following in the logs about my office365 account:
> 22159 \[2018-01-30 10:25:17.142\] \[background\] \[critical\]
> \*\*\* A C++ exception occurred during program...

> <https://github.com/Foundry376/Mailspring/issues/1950>
>
> Describe the bug
> A clear and concise description of what the bug is. Does it happen with all email accounts, or only...

> <https://github.com/Foundry376/Mailspring/issues/1583>
>
> Hi, I have Mailspring v1.6.3 running on Linux Mint 19.1. I have a few accounts--Gmail, Hotmail and Yahoo--added to it. But...

Possibly related:

> <https://github.com/Foundry376/Mailspring/issues/1571>
>
> I recently switched from Thunderbird to Mailspring, but there's some problem with Gmail sync in mailspring. My college account is working...

> <https://github.com/Foundry376/Mailspring/issues/1593>
>
> I'm running KDE Plasma 5.16.3
> Mailspring Version 1.6.3 (this has hapened since I updated from 1.6.2).
> Every day I have to sign into...

---

<div class="post-metadata">

**Author:** ![system](https://community.getmailspring.com/uploads/default/original/1X/3f576930406c827860db462048a1fc090a147a05.png) [@system](https://community.getmailspring.com/u/system)\
**Post date:** [February 1, 2021, 7:23pm UTC](https://community.getmailspring.com/t/database-is-locked/420/2 "2021-02-01T19:23:07Z")

</div>

For about two weeks, the error occurs daily. Usually when I get the laptop out of standby in the morning. At this moment, all old emails (whether read or unread) disappear from the Inbox. Only new emails arriving after the lock error are displayed. Therefore I have to go into the settings daily and press the “Clear cache” button.

Apparently this is primarily related to when the network connection changes. For example, after the standby mode, but apparently the error occurs even if the wireless connection is gone for a short time.

Mailspring: Version 1.6.1  
Distributor ID: neon  
Description:KDE neon User Edition 5.15  
Release: 18.04  
Codename: bionic

* * *

Update: yesterday I downgraded Mailspring to version 1.6.0. The problem with the “Database Locked” seems since then no longer occur. I’ll watch it for a few more days, but it looks like it’s currently a problem with version 1.6.1.

* * *

I can confirm that the bug only occurs in version 1.6.1, but not in version 1.6.0.

* * *

(Originally posted by **[tristanlins](https://github.com/tristanlins)** on GitHub.)

---

<div class="post-metadata">

**Author:** ![ted-gould](https://community.getmailspring.com/user_avatar/community.getmailspring.com/ted-gould/32/647_2.png) [@ted-gould](https://community.getmailspring.com/u/ted-gould)\
**Post date:** [February 5, 2021, 3:40pm UTC](https://community.getmailspring.com/t/database-is-locked/420/3 "2021-02-05T15:40:14Z")

</div>

Getting this often as well. With several accounts. I’m not sure how to “unlock” the database but clearing the cache does seem to work. Here is the latest exception:

```
Mailspring Version: 1.8.0-8983dca2
Platform: linux
Account State: sync_error
Account Provider: imap
IMAP Server: mail.gandi.net
SMTP Server: mail.gandi.net
--------------------------------------------
10929 [2021-02-05 09:32:54.656] [foreground] [info] Unlinking messages WHERE remoteFolderId = ? AND remoteUID IN (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) no longer present in remote range.
10929 [2021-02-05 09:32:54.806] [foreground] [info] -- 0 matches.
10929 [2021-02-05 09:32:54.806] [foreground] [warning] [SLOW] Transaction=unlinkMessagesMatchingQuery > 80ms (150ms, 0 waiting to aquire)
10929 [2021-02-05 09:32:54.806] [foreground] [info] Unlinking messages WHERE remoteFolderId = ? AND remoteUID IN (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) no longer present in remote range.
10929 [2021-02-05 09:32:54.956] [foreground] [info] -- 0 matches.
10929 [2021-02-05 09:32:54.956] [foreground] [warning] [SLOW] Transaction=unlinkMessagesMatchingQuery > 80ms (149ms, 0 waiting to aquire)
10929 [2021-02-05 09:32:54.956] [foreground] [info] Unlinking messages WHERE remoteFolderId = ? AND remoteUID IN (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) no longer present in remote range.
10929 [2021-02-05 09:32:55.108] [foreground] [info] -- 0 matches.
10929 [2021-02-05 09:32:55.108] [foreground] [warning] [SLOW] Transaction=unlinkMessagesMatchingQuery > 80ms (151ms, 0 waiting to aquire)
10929 [2021-02-05 09:32:55.108] [foreground] [info] Unlinking messages WHERE remoteFolderId = ? AND remoteUID IN (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) no longer present in remote range.
10929 [2021-02-05 09:32:55.152] [background] [critical] 
***
*** Mailspring Sync 
*** A C++ exception occurred during program execution: 
*** database is locked
***

```

Not sure that provides much more information though.

---

<div class="post-metadata">

**Author:** ![arrgh](https://community.getmailspring.com/user_avatar/community.getmailspring.com/arrgh/32/1766_2.png) [@arrgh](https://community.getmailspring.com/u/arrgh)\
**Post date:** [April 8, 2021, 4:58pm UTC](https://community.getmailspring.com/t/database-is-locked/420/4 "2021-04-08T16:58:13Z")

</div>

Hi!  
I’m getting sync errors on my accounts in any random order. In logs I can see this:

68055 [2021-04-08 19:51:17.863] [metadata] [info] Metadata delta stream starting…  
68055 [2021-04-08 19:51:20.866] [background] [info] Marking all folders as `busy`  
68055 [2021-04-08 19:51:31.056] [background] [critical]

* * *

\*\*\* Mailspring Sync  
\*\*\* A C++ exception occurred during program execution:  
\*\*\* database is locked

* * *

68055 [2021-04-08 19:51:31.208] [background] [critical] \*\*\* Stack trace (line numbers are approximate):  
\*\*\* in mailsync exceptions::logCurrentExceptionWithStackTrace()  
\*\*\* in mailsync runBackgroundSyncWorker()  
\*\*\* in mailsync main::$\_6::operator()() const  
\*\*\* in mailsync void\* \_\_thread\_proxy(void\*)  
\*\*\* in mailsync thread\_start()

There are 12 accounts now, some of them are GMail other are corporative postfix servers.  
If I push “Reconnect button” it seems start to work for some time.

---

<div class="post-metadata">

**Author:** ![ForsakenHarmony](https://community.getmailspring.com/user_avatar/community.getmailspring.com/forsakenharmony/32/2016_2.png) [@ForsakenHarmony](https://community.getmailspring.com/u/ForsakenHarmony)\
**Post date:** [April 28, 2021, 9:10am UTC](https://community.getmailspring.com/t/database-is-locked/420/5 "2021-04-28T09:10:27Z")

</div>

Having issues with this as well, weirdly it only happens on 1 of 2 Gmail accounts, the older one of the two (still uses `@googlemail.com`)

---

<div class="post-metadata">

**Author:** ![arrgh](https://community.getmailspring.com/user_avatar/community.getmailspring.com/arrgh/32/1766_2.png) [@arrgh](https://community.getmailspring.com/u/arrgh)\
**Post date:** [June 21, 2021, 3:00pm UTC](https://community.getmailspring.com/t/database-is-locked/420/6 "2021-06-21T15:00:18Z")

</div>

I have canceled subscription and quit from using this. Unfortunately.

---

<div class="post-metadata">

**Author:** ![Bas](https://community.getmailspring.com/user_avatar/community.getmailspring.com/bas/32/336_2.png) [@Bas](https://community.getmailspring.com/u/Bas)\
**Post date:** [August 19, 2022, 9:10pm UTC](https://community.getmailspring.com/t/database-is-locked/420/7 "2022-08-19T21:10:53Z")

</div>

To this day this is still an issue that makes it pretty annoying to use Mailspring and honestly makes it hard to recommend as well.

Another bug report from December mentions the same issue as well: [Every time I open this email client there's new crap to deal with. Such a frustrating software](https://community.getmailspring.com/t/every-time-i-open-this-email-client-theres-new-crap-to-deal-with-such-a-frustrating-software/3482)

I don’t understand how this is not a more widespread issue. This used to happen randomly every couple of months a while ago with my very simple IMAP/SMTP account. Now that I’m in a period where I rarely open up my laptop and it has to sync a lot of emails at once (maybe unrelated but this is just what I’m observing anyway) it happens pretty much every time, which means it’s practically unusable for me sadly since I have to completely reset Mailspring every time I want to use it.

---

<div class="post-metadata">

**Author:** ![dhrand](https://community.getmailspring.com/user_avatar/community.getmailspring.com/dhrand/32/10059_2.png) [@dhrand](https://community.getmailspring.com/u/dhrand)\
**Post date:** [April 11, 2025, 9:43pm UTC](https://community.getmailspring.com/t/database-is-locked/420/8 "2025-04-11T21:43:48Z")

</div>

I’m new to Mailspring and started getting this error on the first day…  
Is this ever going to get fixed!!! Anyhow with the lack of active developers on Mailspring looks like I will need to punt on this software.
