SQLITE_BUSY: database is locked

Hello,

sometimes when I have Workflow executions windows open a workflow that runs in background on schedule generates an Error - SQLITE_BUSY: database is locked.

So far I have seen it happening only in Outlook nodes (Edit: also in HTTP request nodes) and the cause is following:

{
“message”: “SQLITE_BUSY: database is locked”,
“errno”: 5,
“code”: “SQLITE_BUSY”,
“__augmented”: true,
“name”: “QueryFailedError”,
“query”: “UPDATE “credentials_entity” SET “name” = ?, “type” = ?, “data” = ?, “nodesAccess” = ?, “updatedAt” = ? WHERE “name” = ? AND “type” = ?”,
“parameters”: [
[email protected]”,
“microsoftOutlookOAuth2Api”,
…NQJ385…”,
“[{“nodeType”:“n8n-nodes-base.microsoftOutlook”,“date”:“2021-03-05T16:27:39.956Z”}]”,
“2021-08-09 08:40:25.133”,
[email protected]”,
“microsoftOutlookOAuth2Api”
]
}

Is it possible to fix it ?

Hello @Rugia

I have seen this issue happening a few times. This means that your database is under some heavy load and n8n is unable to write to it.

Just a quick overview of what happens is that n8n is trying to save the information to the database, but only one process can write at a time. If there are multiple executions or actions happening simultaneously, a few of them might fail to write the updates with this error message.

I would strongly suggest migrating your database from SQLite (which is n8n’s default and great for development puprposes) for MySQL or Postgres (preferably the latter).

This should solve this problem.

1 Like

Hi @krynble

Thank you for the response!

Just fyi if you can not change the database for what reason ever, should also setting:

export EXECUTIONS_PROCESS=main

help with that problem. That will make sure that all executions run in the main process and so parallel access can not happen anymore.

1 Like