fabiofalci / sconsify

A spotify console application
https://fabiofalci.github.io/sconsify
Apache License 2.0
566 stars 26 forks source link

panic: runtime error: invalid memory address or nil pointer dereference #19

Closed maciejwolczyk closed 8 years ago

maciejwolczyk commented 8 years ago

On launch, after succesful login, I get a message attached below. From what I've understood the ALSA warnings aren't really the issue, but I'm not really sure of anything else. I'd like to be more specific, but I honestly don't know where to look and of course I will gladly provide more info.

Logs after calling: ./sconsify --debug=true (Debian Jessie 64-bit, Sconsify r0.2.0).

ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side ALSA lib pcm_route.c:947:(find_matching_chmap) Found no matching channel map ALSA lib pcm_route.c:947:(find_matching_chmap) Found no matching channel map Cannot connect to server socket err = No such file or directory Cannot connect to server request channel jack server is not running or cannot be started panic: runtime error: invalid memory address or nil pointer dereference [signal 0xb code=0x1 addr=0x10 pc=0x49338f]

goroutine 6 [running]: github.com/fabiofalci/sconsify/spotify.(_Spotify).initPlaylist(0xc20804a9c0, 0x0, 0x0) /home/fabio/go/src/github.com/fabiofalci/sconsify/spotify/spotify_playlists.go:26 +0x81f github.com/fabiofalci/sconsify/spotify.(_Spotify).finishInitialisation(0xc20804a9c0, 0xc20803e0a0, 0x0, 0x0) /home/fabio/go/src/github.com/fabiofalci/sconsify/spotify/spotify.go:127 +0x6f github.com/fabiofalci/sconsify/spotify.(*Spotify).checkIfLoggedIn(0xc20804a9c0, 0xc20803e0a0, 0x0, 0x0) /home/fabio/go/src/github.com/fabiofalci/sconsify/spotify/spotify.go:96 +0x12c github.com/fabiofalci/sconsify/spotify.initialiseSpotify(0xc20802a940, 0xa, 0xc20802aa70, 0xf, 0x10, 0xc20804a960, 0xc20802a8a0, 0x0, 0x0) /home/fabio/go/src/github.com/fabiofalci/sconsify/spotify/spotify.go:45 +0x26e github.com/fabiofalci/sconsify/spotify.Initialise(0xc20802a940, 0xa, 0xc20802aa70, 0xf, 0x10, 0xc20804a960, 0xc20802a8a0) /home/fabio/go/src/github.com/fabiofalci/sconsify/spotify/spotify.go:25 +0x81 created by main.main /home/fabio/go/src/github.com/fabiofalci/sconsify/sconsify.go:56 +0x76d

goroutine 1 [select]: github.com/fabiofalci/sconsify/sconsify.StartMainLoop(0xc20804a960, 0x7fa302d4ed98, 0x94c258, 0x0, 0x0, 0x0) /home/fabio/go/src/github.com/fabiofalci/sconsify/sconsify/mainloop.go:4 +0x63a main.main() /home/fabio/go/src/github.com/fabiofalci/sconsify/sconsify.go:60 +0x7c1

goroutine 4 [runnable, locked to thread]: github.com/op/go-libspotify/spotify._Cfunc_sp_artist_release(0x7fa2f42e25c0, 0x0) /home/fabio/go/src/github.com/op/go-libspotify/spotify/:275 +0x43 github.com/op/go-libspotify/spotify.(*Artist).release(0xc2080c6ab0) /home/fabio/go/src/github.com/op/go-libspotify/spotify/libspotify.go:2117 +0x83

goroutine 5 [syscall]: os/signal.loop() /usr/lib/go/src/os/signal/signal_unix.go:21 +0x1f created by os/signal.init·1 /usr/lib/go/src/os/signal/signal_unix.go:27 +0x35

goroutine 17 [syscall, locked to thread]: runtime.goexit() /usr/lib/go/src/runtime/asm_amd64.s:2232 +0x1

goroutine 7 [runnable, locked to thread]: github.com/op/go-libspotify/spotify._Cfunc_sp_session_process_events(0x7fa2f400b260, 0xc20801d620, 0x0) /home/fabio/go/src/github.com/op/go-libspotify/spotify/:905 +0x43 github.com/op/go-libspotify/spotify.(*Session).processEvents(0xc208066000) /home/fabio/go/src/github.com/op/go-libspotify/spotify/libspotify.go:878 +0xd6 github.com/op/go-libspotify/spotify.func·001() /home/fabio/go/src/github.com/op/go-libspotify/spotify/libspotify.go:243 +0x141 created by github.com/op/go-libspotify/spotify.NewSession /home/fabio/go/src/github.com/op/go-libspotify/spotify/libspotify.go:244 +0x819

goroutine 9 [select]: github.com/op/go-libspotify/spotify.(*Session).processBackground(0xc208066000) /home/fabio/go/src/github.com/op/go-libspotify/spotify/libspotify.go:900 +0x2ad created by github.com/op/go-libspotify/spotify.NewSession /home/fabio/go/src/github.com/op/go-libspotify/spotify/libspotify.go:250 +0x8c8

goroutine 18 [syscall, locked to thread]: runtime.goexit() /usr/lib/go/src/runtime/asm_amd64.s:2232 +0x1

goroutine 10 [chan send]: github.com/fabiofalci/sconsify/spotify.func·001() /home/fabio/go/src/github.com/fabiofalci/sconsify/spotify/spotify.go:103 +0x62 created by github.com/fabiofalci/sconsify/spotify.(*Spotify).waitForSuccessfulConnectionStateUpdates /home/fabio/go/src/github.com/fabiofalci/sconsify/spotify/spotify.go:104 +0xc1

goroutine 11 [chan receive]: github.com/fabiofalci/sconsify/spotify.(_portAudio).player(0xc20803e0a0) /home/fabio/go/src/github.com/fabiofalci/sconsify/spotify/portaudio.go:50 +0x25d created by github.com/fabiofalci/sconsify/spotify.(_Spotify).finishInitialisation /home/fabio/go/src/github.com/fabiofalci/sconsify/spotify/spotify.go:124 +0x49

fabiofalci commented 8 years ago

It looks like a bug when creating a folder playlist.

This line

playlists.AddPlaylist(sconsify.InitFolder(strconv.Itoa(int(folder.Id())), folder.Name(), folderPlaylists))

For some reason folder looks to be null. Maybe you have some empty folder?

Anyhow I can check for null pointer before trying to create it.

mrbohnke commented 8 years ago

looks like I'm having the same issue (OS X 10.11.2):

Sconsify - your awesome Spotify music service in a text-mode interface.
Provided username: myUsername
Password: ******
2016-01-11 11:34:09.922 sconsify[2729:196641] 11:34:09.921 WARNING:  140: This application, or a library it uses, is using the deprecated Carbon Component Manager for hosting Audio Units. Support for this will be removed in a future release. Also, this makes the host incompatible with version 3 audio units. Please transition to the API's in AudioComponent.h.
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x10 pc=0x408ba7f]

goroutine 6 [running]:
github.com/fabiofalci/sconsify/spotify.(*Spotify).initPlaylist(0xc20804a720, 0x0, 0x0)
    /Users/fabio/go/src/github.com/fabiofalci/sconsify/spotify/spotify_playlists.go:26 +0x81f
github.com/fabiofalci/sconsify/spotify.(*Spotify).finishInitialisation(0xc20804a720, 0xc208038028, 0x0, 0x0)
    /Users/fabio/go/src/github.com/fabiofalci/sconsify/spotify/spotify.go:127 +0x6f
github.com/fabiofalci/sconsify/spotify.(*Spotify).checkIfLoggedIn(0xc20804a720, 0xc208038028, 0x0, 0x0)
    /Users/fabio/go/src/github.com/fabiofalci/sconsify/spotify/spotify.go:96 +0x12c
github.com/fabiofalci/sconsify/spotify.initialiseSpotify(0xc20800a48a, 0x8, 0xc20802a580, 0xc, 0x10, 0xc20804a6c0, 0xc20802a2d0, 0x0, 0x0)
    /Users/fabio/go/src/github.com/fabiofalci/sconsify/spotify/spotify.go:45 +0x26e
github.com/fabiofalci/sconsify/spotify.Initialise(0xc20800a48a, 0x8, 0xc20802a580, 0xc, 0x10, 0xc20804a6c0, 0xc20802a2d0)
    /Users/fabio/go/src/github.com/fabiofalci/sconsify/spotify/spotify.go:25 +0x81
created by main.main
    /Users/fabio/go/src/github.com/fabiofalci/sconsify/sconsify.go:56 +0x76d

goroutine 1 [select, 2 minutes]:
github.com/fabiofalci/sconsify/sconsify.StartMainLoop(0xc20804a6c0, 0x469dd68, 0x4338c20, 0x0, 0x0, 0x0)
    /Users/fabio/go/src/github.com/fabiofalci/sconsify/sconsify/mainloop.go:4 +0x63a
main.main()
    /Users/fabio/go/src/github.com/fabiofalci/sconsify/sconsify.go:60 +0x7c1

goroutine 5 [syscall, 2 minutes]:
os/signal.loop()
    /usr/local/go/src/os/signal/signal_unix.go:21 +0x1f
created by os/signal.init·1
    /usr/local/go/src/os/signal/signal_unix.go:27 +0x35

goroutine 17 [runnable, locked to thread]:
runtime.goexit()
    /usr/local/go/src/runtime/asm_amd64.s:2232 +0x1

goroutine 7 [select, locked to thread]:
github.com/op/go-libspotify/spotify.(*Session).processEvents(0xc20800c160)
    /Users/fabio/go/src/github.com/op/go-libspotify/spotify/libspotify.go:886 +0x340
github.com/op/go-libspotify/spotify.func·001()
    /Users/fabio/go/src/github.com/op/go-libspotify/spotify/libspotify.go:243 +0x141
created by github.com/op/go-libspotify/spotify.NewSession
    /Users/fabio/go/src/github.com/op/go-libspotify/spotify/libspotify.go:244 +0x819

goroutine 9 [select]:
github.com/op/go-libspotify/spotify.(*Session).processBackground(0xc20800c160)
    /Users/fabio/go/src/github.com/op/go-libspotify/spotify/libspotify.go:900 +0x2ad
created by github.com/op/go-libspotify/spotify.NewSession
    /Users/fabio/go/src/github.com/op/go-libspotify/spotify/libspotify.go:250 +0x8c8

goroutine 18 [syscall, 2 minutes, locked to thread]:
runtime.goexit()
    /usr/local/go/src/runtime/asm_amd64.s:2232 +0x1

goroutine 10 [chan send, 1 minutes]:
github.com/fabiofalci/sconsify/spotify.func·001()
    /Users/fabio/go/src/github.com/fabiofalci/sconsify/spotify/spotify.go:103 +0x62
created by github.com/fabiofalci/sconsify/spotify.(*Spotify).waitForSuccessfulConnectionStateUpdates
    /Users/fabio/go/src/github.com/fabiofalci/sconsify/spotify/spotify.go:104 +0xc1

goroutine 11 [chan receive, 2 minutes]:
github.com/fabiofalci/sconsify/spotify.(*portAudio).player(0xc208038028)
    /Users/fabio/go/src/github.com/fabiofalci/sconsify/spotify/portaudio.go:50 +0x25d
created by github.com/fabiofalci/sconsify/spotify.(*Spotify).finishInitialisation
    /Users/fabio/go/src/github.com/fabiofalci/sconsify/spotify/spotify.go:124 +0x49
fabiofalci commented 8 years ago

Thanks for reporting.

There is a fix on the way, it seems for some reason the playlist we get from spotify is null, so we need to check for that.

maciejwolczyk commented 8 years ago

Version by ialbors posted here https://github.com/fabiofalci/sconsify/issues/22#issuecomment-171595760 works very well, so I think we can close this thread. Thanks for the great work guys!

mrbohnke commented 8 years ago

I updated to 0.2.1 as I understood it addressed this problem, but it's still showing up. Just in case this could help:

$ ./sconsify -version
Version: 0.2.1
Git commit: fec094a
Build date: Sun 17 Jan 2016 00:24:40 UTC
Sconsify - your awesome Spotify music service in a text-mode interface.
Provided username: myusername
Password: *******
2016-01-18 11:17:57.530 sconsify[943:30375] 11:17:57.529 WARNING:  140: This application, or a library it uses, is using the deprecated Carbon Component Manager for hosting Audio Units. Support for this will be removed in a future release. Also, this makes the host incompatible with version 3 audio units. Please transition to the API's in AudioComponent.h.
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x10 pc=0x40a9299]

goroutine 6 [running]:
github.com/fabiofalci/sconsify/spotify.(*Spotify).initPlaylist(0xc82003fe78, 0x0, 0x0)
    /Users/fabio/go/src/github.com/fabiofalci/sconsify/spotify/spotify_playlists.go:26 +0x819
github.com/fabiofalci/sconsify/spotify.(*Spotify).finishInitialisation(0xc82003fe78, 0xc82002e098, 0x0, 0x0)
    /Users/fabio/go/src/github.com/fabiofalci/sconsify/spotify/spotify.go:127 +0x75
github.com/fabiofalci/sconsify/spotify.(*Spotify).checkIfLoggedIn(0xc82003fe78, 0xc82002e098, 0x0, 0x0)
    /Users/fabio/go/src/github.com/fabiofalci/sconsify/spotify/spotify.go:96 +0x117
github.com/fabiofalci/sconsify/spotify.initialiseSpotify(0xc82000c4aa, 0x8, 0xc82000ae80, 0xc, 0x10, 0xc8200189c0, 0xc82000aca0, 0x0, 0x0)
    /Users/fabio/go/src/github.com/fabiofalci/sconsify/spotify/spotify.go:45 +0x241
github.com/fabiofalci/sconsify/spotify.Initialise(0xc82000c4aa, 0x8, 0xc82000ae80, 0xc, 0x10, 0xc8200189c0, 0xc82000aca0)
    /Users/fabio/go/src/github.com/fabiofalci/sconsify/spotify/spotify.go:25 +0x7e
created by main.main
    /Users/fabio/go/src/github.com/fabiofalci/sconsify/sconsify.go:56 +0xb12

goroutine 1 [select]:
github.com/fabiofalci/sconsify/sconsify.StartMainLoop(0xc8200189c0, 0x4ea4550, 0x4398480, 0x4ea4500, 0x0, 0x0)
    /Users/fabio/go/src/github.com/fabiofalci/sconsify/sconsify/mainloop.go:4 +0x6ee
main.main()
    /Users/fabio/go/src/github.com/fabiofalci/sconsify/sconsify.go:60 +0xd4a

goroutine 17 [syscall, locked to thread]:
runtime.goexit()
    /usr/local/Cellar/go/1.5.3/libexec/src/runtime/asm_amd64.s:1721 +0x1

goroutine 5 [syscall]:
os/signal.loop()
    /usr/local/Cellar/go/1.5.3/libexec/src/os/signal/signal_unix.go:22 +0x18
created by os/signal.init.1
    /usr/local/Cellar/go/1.5.3/libexec/src/os/signal/signal_unix.go:28 +0x37

goroutine 7 [select, locked to thread]:
github.com/op/go-libspotify/spotify.(*Session).processEvents(0xc8200aa580)
    /Users/fabio/go/src/github.com/op/go-libspotify/spotify/libspotify.go:886 +0x372
github.com/op/go-libspotify/spotify.NewSession.func1(0xc8200aa580, 0xc820019080)
    /Users/fabio/go/src/github.com/op/go-libspotify/spotify/libspotify.go:243 +0x1a0
created by github.com/op/go-libspotify/spotify.NewSession
    /Users/fabio/go/src/github.com/op/go-libspotify/spotify/libspotify.go:244 +0x6e3

goroutine 18 [select]:
github.com/op/go-libspotify/spotify.(*Session).processBackground(0xc8200aa580)
    /Users/fabio/go/src/github.com/op/go-libspotify/spotify/libspotify.go:900 +0x2c1
created by github.com/op/go-libspotify/spotify.NewSession
    /Users/fabio/go/src/github.com/op/go-libspotify/spotify/libspotify.go:250 +0x788

goroutine 34 [syscall, locked to thread]:
runtime.goexit()
    /usr/local/Cellar/go/1.5.3/libexec/src/runtime/asm_amd64.s:1721 +0x1

goroutine 35 [chan send]:
github.com/fabiofalci/sconsify/spotify.(*Spotify).waitForSuccessfulConnectionStateUpdates.func1(0xc8200d22a0)
    /Users/fabio/go/src/github.com/fabiofalci/sconsify/spotify/spotify.go:103 +0x4f
created by github.com/fabiofalci/sconsify/spotify.(*Spotify).waitForSuccessfulConnectionStateUpdates
    /Users/fabio/go/src/github.com/fabiofalci/sconsify/spotify/spotify.go:104 +0x5f

goroutine 19 [chan receive]:
github.com/fabiofalci/sconsify/spotify.(*portAudio).player(0xc82002e098)
    /Users/fabio/go/src/github.com/fabiofalci/sconsify/spotify/portaudio.go:50 +0x252
created by github.com/fabiofalci/sconsify/spotify.(*Spotify).finishInitialisation
    /Users/fabio/go/src/github.com/fabiofalci/sconsify/spotify/spotify.go:124 +0x4a
fabiofalci commented 8 years ago

Probably I forgot to pull the changes when creating the osx binary. I'll do now and update the binary there.

mrbohnke commented 8 years ago

Awesome. I'll let you know. Thank you very much!

fabiofalci commented 8 years ago

Yeah, in fact I forgot to update in both, linux and osx. Thank you for reporting!

Binary updated: https://github.com/fabiofalci/sconsify/releases/tag/v0.2.1

When checking the version the git commit should be:

Git commit: f93458f

mrbohnke commented 8 years ago

It totally works, now : )