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.74k stars 774 forks source link

[Bug Report] Failing to delete files #2260

Open T-prog3 opened 2 years ago

T-prog3 commented 2 years ago

Describe the bug Stash often fails to delete marked files and says the reason is because of "used by another process". This bug makes it really annoying when you carefully have selected over 300 pictures to delete just to realize that you wasted your time and have to start over after refreshing the site.

To Reproduce Steps to reproduce the behavior:

  1. Go to Images
  2. Change page size to be able to select more files
  3. Start marking files you want to delete.
  4. Click on the delete button and check "Delete file" and press Delete
  5. If you where lucky the files got deleted and you can go back to Step 3 and repeat until you get the error.
  6. The error mostly occur within the first, second or third iteration.
kermieisinthehouse commented 2 years ago

Do you have any other process working on your media files? Another media organizer, Plex, antivirus maybe? What platform is this happening on?

FYI, refreshing the page probably won't have any effect on this issue, you can just retry.

T-prog3 commented 2 years ago

That was my first thoughts also but nothing else is working on the files that would hold them captured. The server is running version v0.12.0 on Windows.

And FYI, refreshing do have an instant effect on the issue. Retrying only makes you end-up with the same error over and over until you do refresh the page. And that makes me think of the problem as being related to the software. As if it gets stuck in a broken state and doesn't get the latest news.

Could there be anything related to the server still processing the request of N files to be shown on the page when the media selection is started?

stg-annon commented 2 years ago

are they set to read only?

T-prog3 commented 2 years ago

No they are not read only. And i would think that if that were the case a simple page refresh wouldn't make any difference. But as i said a simple refresh usually allows you to delete the files on next try. You may succeed with the deletion at the time but the error will occur sooner or later and you wasted a lot of time selecting the files. In my case it's more reliable to just go into explorer and select the files there. You wouldn't want to carefully select thousands of files just to realize you have to start over.

bnkai commented 2 years ago

Can you check your scan options and see if Generate thumbnails for images is ticked ? If the issue is only for images and you have a lot of images shown per page it might be an issue of trying to delete while generating the thumbnails or loading the page. Checking the option above generates the thumbnails during scan and should fix the issue(you can rescan to generate the missing thumbnails) TBF i dont think stash should be used to alter/remove your library files even if the delete functionality is present. (You could delete the images as you stated from the explorer and then run the clean task from stash once you are done)

T-prog3 commented 2 years ago

I tried both with and without Generate thumbnails for images and did rescan but it made no difference. The weirdest part is this that just happened:

  1. Lets say that i show 1000 images on the page (Error will still occur with only 40 images showing, but this is my standard).
  2. I select 25 pictures and press delete with both Delete file and Delete generated supporting files ticked. This will usually work in 9/10 when it is the first time you delete something after opening stash or after refreshing the page.
  3. With this action being completed, i will now get 25 new pictures showing at the very bottom of the 975 other images.
  4. To really make sure that everything is loaded i wait 10 seconds after all images are showing.
  5. I select 1 of these 25 pictures and press delete with both Delete file and Delete generated supporting files ticked. And the error occur.
  6. If i try to delete again... Same error occur (you can try over and over, even wait 5 minutes and still error). But now when i refresh the page it allows me to select and delete with success. To me this makes no sense.

TBH Stash is superior to explorer when you want to clean out your image library because you get a better overview, especially if you use a browser plugin like Imagus. Only downside of Stash is the present error and the absents of a drag-select function like you get with CTRL + Mouse drag in Windows.

Edit: When i check the server console i can see that there are no requests being processed other than two Graphql post requests on each tried failed attempt.

"POST http://localhost:9999/graphql HTTP/1.1" from 127.0.0.1:55707 - 200 259B in 2.9984ms "POST http://localhost:9999/graphql HTTP/1.1" from 127.0.0.1:55707 - 200 3082B in 570.7641ms