stashapp / stash

An organizer for your porn, written in Go. Documentation: https://docs.stashapp.cc
https://stashapp.cc/
GNU Affero General Public License v3.0
8.8k stars 778 forks source link

[Bug Report] Cannot perform any 'Update' operations while a long running process (AutoTag or Scan (with new scenes added) is running #3053

Closed cobra-chicken closed 1 year ago

cobra-chicken commented 1 year ago

Describe the bug When (1) long running task occurs, then a second 'update' task occurs while the long running task is still running. An error appears:

updating scenes: executing UPDATEscenesSETdate=?,details=?,rating=?,studio_id=?,title=?,updated_at=?,url=? WHERE (scenes.id= ?) [[0001-01-01 SceneName 2022-10-25T14:56:06-04:00 > > https://someUrl.com/movies/someMovieTitle-cj 3082]]: database is locked

Another example of error:

error executing UPDATE studios SET checksum=:checksum, name=:name, url=:url, updated_at=:updated_at, rating=:rating, details=:details, ignore_auto_tag=:ignore_auto_tag WHERE studios.id = :id [[{1524 0xc03c342240 0xc03b5e8630 0xc03b5e8648 0xc03b5e8618 0xc09e2a3350 0xc03b5e8660 0xc09e2a3320}]]: database is locked

To Reproduce

Steps to reproduce the behavior:

  1. Go and run a long running task (either scan with new files, or auto update
  2. Update some existing data, such as a scene, or studio, or performer
  3. Upon clicking 'save' on the update of data, the error will appear
  4. See error

Expected behavior Update (scene / performer / studio ) is successful while a long running background task is running

Screenshots Error messages above

Stash Version: v0.17.1:

Desktop (please complete the following information):

Additional context

stg-annon commented 1 year ago

This issue is especially apparent with any hook plugins that use Scene.Create.Post where some edit attempts might go through and others are blocked

The current workaround is to retry failed edits similar to how a user might spam save on a scene while a scan is running to get past the error