Database locked after Image phash generation

I recently downloaded the latest release (v0.31.0) of Stash and migrated my database to check out the new features. I started by running a selective generation task and calculating phashes for a few images, which worked fine.

I then started a phash generation task for my entire image library. Two days in, I got a bit concerned that it was still running, so I checked the /config folder and saw that the SQLite database’s -wal file had grown to 112 GB. I decided to cancel the task and see how many images had been updated.

As I monitored the -shm, -wal, and database sizes, I opened the image tab and got an error message: “Error loading items beginning transaction: database is locked.” The -shm file grew, and the -wal file shrunk to around 105 GB. I figured it might take some time to commit the generated phashes to the database, so I let it sit overnight.

This morning, I found that the -wal file was still 105 GB. The -shm file grows to around 220 MB, then resets to 0 and grows again, while the -wal file stays the same size.

Can you help me figure out what’s going on and how to recover from this? What steps can I try to resolve the issue? I’d really appreciate some advice.

sqlite3 stash-go.sqlite
> VACUUM;
> .quit;

make sure stash is not running. that should flush your WAL to your database, otherwise you might need Recovering Data From A Corrupt SQLite Database to forcibly unbork your database

Thanks for the reply!

Before your suggestion I decided to restart the container. That worked all by itself.

The restart took longer than usual but after stash was up the wal was emptied and the database accessible again.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.