Skip to content

sqlite in wal mode has concurrency bugs #177

Closed

Description

@mornfall

when too many processes try to access a WAL-mode sqlite database at once, some of them fail like this:

error: adding reference to database: unable to open database file

(this means the database was already opened before by the same process; there may be races in access to the -wal and/or -shm files for all I can tell, or it might be a more involved problem deep in sqlite; cf. http://osdir.com/ml/sqlite-users/2013-10/msg00050.html)

PS: Since WAL can't be disabled due to #176, this makes nix nearly unusable with heavy parallel loads, as processes randomly die with database errors.

Activity

  1. edolstra commented on Nov 25, 2013

    @edolstra
    Member

    FWIW, hydra.nixos.org uses Nix in WAL mode with plenty of concurrency.

  2. mornfall commented on Nov 25, 2013

    @mornfall
    Author

    Well, the problem might be triggered by building nars, because they add many .drv files to the store, while many unrelated nix-store --import's are running. We run with up to 160 active builds at the same time (in different phases though, so only a subset will be hammering at the sqlite db at once even in the worst-case scenarios... each build triggers an --import followed by nix-push).

  3. edolstra commented on Apr 3, 2018

    @edolstra
    Member

    Closing because this issue is apparently not seen recently.

  4. added a commit that references this issue on Jan 1, 2024
  5. added a commit that references this issue on Sep 4, 2025
  6. added 9 commits that reference this issue on Aug 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions