Skip to content

[Bug]: Job processing tasks may raise "database is locked" errors #825

Closed

Description

@r4victor

dstack version

master

Python version

3.11

Host OS

macOS 13.4

Host Arch

ARM

What happened?

We occasionally observe "database is locked" errors in sentry:

OperationalError
(sqlite3.OperationalError) database is locked
[SQL: UPDATE jobs SET last_processed_at=? WHERE jobs.id = ?]

In sqlite, a writer transaction locks the db. We have busy_timeout=5000, so other writers can wait up to 5s. The reasons for "database is locked" can be:

  • litestream locks the db causing app connections to timeout (unlikely since it runs every second).
  • long-running writing transactions lock the db for.

CLI logs

No response

Server logs

No response

Runner logs

No response

Additional Information

No response

Activity

  1. r4victor commented on Jan 9, 2024

    @r4victor
    CollaboratorAuthor

    To lower probability of "database is locked" errors, ensure there are no long-running writing transactions. That is, ensure the commit takes place immediately after any DML operation.

  2. self-assigned this
    on Jan 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions