Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug Report] Panic in Generate #2250

Closed
kermieisinthehouse opened this issue Jan 22, 2022 · 3 comments · Fixed by #2319
Closed

[Bug Report] Panic in Generate #2250

kermieisinthehouse opened this issue Jan 22, 2022 · 3 comments · Fixed by #2319
Labels
bug report Bug reports that are not yet verified bug Something isn't working

Comments

@kermieisinthehouse
Copy link
Collaborator

Probably introduced in #2167

panic: runtime error: integer divide by zero

goroutine 105 [running]:
github.com/stashapp/stash/pkg/manager.(*GeneratorInfo).configure(0xc000136500)
    github.com/stashapp/stash/pkg/manager/generator.go:115 +0x9d
github.com/stashapp/stash/pkg/manager.(*PreviewGenerator).Generate(0xc000018310)
    github.com/stashapp/stash/pkg/manager/generator_preview.go:56 +0x78
github.com/stashapp/stash/pkg/manager.(*GeneratePreviewTask).Start(0xc00039a000, {0x198fc98, 0xc0001fa600})
    github.com/stashapp/stash/pkg/manager/task_generate_preview.go:59 +0x4b5
github.com/stashapp/stash/pkg/manager.(*GenerateJob).Execute.func3()
    github.com/stashapp/stash/pkg/manager/task_generate.go:127 +0x3c
github.com/stashapp/stash/pkg/job.(*Progress).ExecuteTask(0xc0001fa700, {0xc00038e160, 0xa9}, 0xc0001f2d00)
    github.com/stashapp/stash/pkg/job/progress.go:153 +0xcd
created by github.com/stashapp/stash/pkg/manager.(*GenerateJob).Execute
    github.com/stashapp/stash/pkg/manager/task_generate.go:126 +0x3bb

Stash Version: (from Settings -> About):
0.12.0

Desktop (please complete the following information):

  • OS: Docker on MacOS
@kermieisinthehouse kermieisinthehouse added the bug Something isn't working label Jan 22, 2022
@kermieisinthehouse kermieisinthehouse added this to the Version 0.13.0 milestone Jan 22, 2022
@kermieisinthehouse
Copy link
Collaborator Author

It looks like setting segments or duration to 0 in the preview generation options will cause division by 0. We need some validation there.

@kermieisinthehouse kermieisinthehouse added the bug report Bug reports that are not yet verified label Jan 22, 2022
@bnkai
Copy link
Collaborator

bnkai commented Jan 22, 2022

#2167 only changed code for the sprites generation so i dont think it was related

I think the issue is the Number of segments in preview that is set to 0
From a quick look

g.NthFrame = g.NumberOfFrames / g.ChunkCount

stepSize = duration / float64(g.ChunkCount)

could be the cause

For the segment duration option we already take care of that as having too small of a duration had some issues

if durationSegment < 0.75 { // a very short duration can create files without a video stream

For the chunkcount idk if its better to set it to 1 if its <1 (doesnt make sense with numbers <1) in the above function, before stepSize, offset := g.Info.getStepSizeAndOffset() or just/also alter the generator functions

g.NthFrame = g.NumberOfFrames / g.ChunkCount
stepSize = duration / float64(g.ChunkCount)
to also check

An extra chek here chould also be added

generator.Info.ChunkCount = *t.Options.PreviewSegments

@kermieisinthehouse
Copy link
Collaborator Author

This is what it was, the user had set segments to 0. We should disallow that in the UI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug report Bug reports that are not yet verified bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants