Nothing Special   »   [go: up one dir, main page]

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

nil pointer dereference in cmd/daemon/controls.go:42 #79

Open
ius opened this issue Sep 4, 2024 · 1 comment
Open

nil pointer dereference in cmd/daemon/controls.go:42 #79

ius opened this issue Sep 4, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@ius
Copy link
ius commented Sep 4, 2024

Not entirely sure how I triggered it, but there's a nil pointer dereference path in:

log.WithField("uri", nextId.Uri()).
Infof("prefetched %s %s (duration: %dms)", nextId.Type(),
strconv.QuoteToGraphic(p.secondaryStream.Media.Name()), p.secondaryStream.Media.Duration())

INFO[0007] loaded track "All It Takes" (paused: false, position: 399105ms, duration: 328800ms, prefetched: false)  uri="spotify:track:1H8RteGZrEFg5zuvy9Kljz"
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x94216e]

goroutine 124 [running]:
main.(*AppPlayer).prefetchNext(0xc000160780)
        /home/user/git/go-librespot/cmd/daemon/controls.go:42 +0x60e
created by main.(*AppPlayer).schedulePrefetchNext in goroutine 1
        /home/user/git/go-librespot/cmd/daemon/controls.go:56 +0x18c

I suppose p.secondaryStream.Media is nil here?

@devgianlu devgianlu added the bug Something isn't working label Sep 5, 2024
@devgianlu
Copy link
Owner

Media is only written upon initialization of the object and is surely non-nil at that time. I think secondaryStream became nil because prefetchNext runs in a goroutine and shouldn't access that stuff directly as the goroutine that handles command may be changing stuff (for example in loadCurrentTrack).

It is not trivial to fix, but hopefully shouldn't happen very often.

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

No branches or pull requests

2 participants