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

Closed

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.

Activity

  1. skx commented on Feb 12, 2019

    @skx
    Owner

    That looks sane, and safe. Sorry for the delay.

    If you submit a pull-request with the change I'll accept it. Otherwise I'll make a new release over the weekend when I get round to it.

  2. skx commented on Feb 17, 2019

    @skx
    Owner

    Closed by your pull-request in #56, much appreciated.

    New release will be made within the hour.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      ⌂ 换网址