Skip to content
This repository was archived by the owner on Sep 10, 2025. It is now read-only.
This repository was archived by the owner on Sep 10, 2025. It is now read-only.

Pruning/auto-pruning not working due to locked database #55

@attilasol

Description

@attilasol

When running
puppet-summary prune
with any command-line flag, the command returns
Error pruning: database is locked
and pruning does not occur. The -verbose flag did not provide more information.
-auto-prune is also affected, judging from the ever-increasing space occupied by reports. (Edit: Actually, it doesn't seem to be affected; my bad.)
I was able to reproduce the issue on multiple clean Vagrant boxes running Debian Stretch.
To reproduce:

  • Install puppet-summary, using the binary release, go get installation or building it manually from source.
  • Start puppet-summary directly with puppet-summary serve
  • (Import some data)
  • Execute puppet-summary prune with any option/flag combination

I was able to resolve my issue by modifying SetupDB code & rebuilding:

@@ -84,7 +84,7 @@ func SetupDB(path string) error {
        //
        // Return if the database already exists.
        //
-       db, err = sql.Open("sqlite3", path)
+  db, err = sql.Open("sqlite3", "file:"+path+"?_journal_mode=WAL")
        if err != nil {
                return err
        }

I was "inspired" to try this after reading mattn/go-sqlite3#607 (among many other related issues), but I'm not particularly suggesting my fix -- I'll gladly admit that I'm out of my depth.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions