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
9.09k stars 788 forks source link

[Bug Report] stash had a panic when Tagging Performers #4280

Closed alephalpha0 closed 11 months ago

alephalpha0 commented 11 months ago

Describe the bug I was using the Performer Tagger function in Stash when it stopped and threw out this error message in the logs.. I don't really know what happened or how to reproduce the error..

To Reproduce :man_shrugging:

Expected behavior Scrape Performer Information without panicking.

Stash Version: (from Settings -> About): v0.23.1

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context stash.log output:

ERRO[2023-11-11 04:40:05] panic in job 17 - Batch stash-box performer tag...: runtime error: invalid memory address or nil pointer dereference 
ERRO[2023-11-11 04:40:05] goroutine 1218666 [running]:
runtime/debug.Stack()
    runtime/debug/stack.go:24 +0x65
github.com/stashapp/stash/pkg/job.(*Manager).executeJob.func1()
    github.com/stashapp/stash/pkg/job/manager.go:200 +0x165
panic({0x7f6f6e338c80, 0x7f6f6edc8210})
    runtime/panic.go:884 +0x212
github.com/stashapp/stash/pkg/scraper/stashbox.Client.FindStashBoxPerformerByID({0xc0010f60d8, {0x7f6f6e4f4ca0, 0xc000d22680}, {{0x7f6f4451ab10, 0xc00042eaf0}, {0x7f6f4451ab48, 0xc000163e60}, {0x7f6f4451aba0, 0xc000163f20}, {0x7f6f4451abc8, ...}}, ...}, ...)
    github.com/stashapp/stash/pkg/scraper/stashbox/stash_box.go:810 +0x72
github.com/stashapp/stash/internal/manager.(*StashBoxBatchTagTask).findStashBoxPerformer(0xc00053de48, {0x7f6f6e4f3ed8, 0xc000d20400})
    github.com/stashapp/stash/internal/manager/task_stash_box_tag.go:121 +0x46b
github.com/stashapp/stash/internal/manager.(*StashBoxBatchTagTask).stashBoxPerformerTag(0xc00053de48, {0x7f6f6e4f3ed8, 0xc000d20400})
    github.com/stashapp/stash/internal/manager/task_stash_box_tag.go:66 +0x46
github.com/stashapp/stash/internal/manager.(*StashBoxBatchTagTask).Start(0x7f6f6cdd3ee0?, {0x7f6f6e4f3ed8?, 0xc000d20400?})
    github.com/stashapp/stash/internal/manager/task_stash_box_tag.go:36 +0xca
github.com/stashapp/stash/internal/manager.(*Manager).StashBoxBatchPerformerTag.func1.3()
    github.com/stashapp/stash/internal/manager/manager_tasks.go:476 +0x25
github.com/stashapp/stash/pkg/job.(*Progress).ExecuteTask(0xc000f2adc0, {0xc0005b7140, 0x2a}, 0xc00053ddd8)
    github.com/stashapp/stash/pkg/job/progress.go:175 +0xcd
github.com/stashapp/stash/internal/manager.(*Manager).StashBoxBatchPerformerTag.func1({0x7f6f6e4f3ed8, 0xc000d20400}, 0x7f6f6c8be201?)
    github.com/stashapp/stash/internal/manager/manager_tasks.go:475 +0x618
github.com/stashapp/stash/pkg/job.(*jobExecImpl).Execute(0xc002509798?, {0x7f6f6e4f3ed8?, 0xc000d20400?}, 0xc000ade018?)
    github.com/stashapp/stash/pkg/job/job.go:18 +0x2f
github.com/stashapp/stash/pkg/job.(*Manager).executeJob(0xc00042eb60, {0x7f6f6e4f3ed8, 0xc000d20400}, 0xc0003dab40, 0xc000eaa300?)
    github.com/stashapp/stash/pkg/job/manager.go:209 +0x1a4
created by github.com/stashapp/stash/pkg/job.(*Manager).dispatch
    github.com/stashapp/stash/pkg/job/manager.go:186 +0x20f 
DingDongSoLong4 commented 11 months ago

@alephalpha0 I believe the cause of this is a performer with an invalid Stash ID - i.e. that Stash ID doesn't exist on the stash-box at all. Usually deleting performers in a stash-box only sets a deleted flag and doesn't purge the ID entirely, so it's strange that this is happening in the first place.

So either the performer in question was completely removed from the stash-box, or it's possible that your database could have been corrupted in some way that modified a performer's Stash ID to make it invalid. It would probably be a good idea to try and figure out which performer in your DB has the invalid ID, which you should be able to do using a combination of the "Current page" option in the Batch Update Performers dialog and setting custom page sizes.