sp_session_starred_create segmentation fault #60

Closed
kingosticks opened this Issue Aug 4, 2015 · 7 comments

Projects

None yet

3 participants

@kingosticks
Member

Every time I connect to the Mopidy websocket with a webclient, Mopidy will crash with "Segmentation fault (core dumped)". I think this is caused by JsonRpcInspector finding get_playlists through the playlists property when core.describe is called.

(gdb) bt
#0  0x00007fd6dc00617c in ?? ()
#1  0x00007fd6ffdbfa8b in sp_session_starred_create () from /usr/lib/libspotify.so.12
#2  0x00007fd7000dde6c in _cffi_f_sp_session_starred_create (self=<optimised out>, arg0=<_cffi_backend.CData at remote 0x7fd6ff192508>) at build/temp.linux-x86_64-2.7/spotify._spotify.c:10979
#3  0x000000000052f936 in PyInt_AsUnsignedLongMask (op=()) at ../Objects/intobject.c:277
#4  0x00007fd6fda7c3d0 in ?? ()
#5  0x0000000000000000 in ?? ()

There is a verbose log at http://dpaste.com/1PD98M9. Removing my Spotify cache files doesn't appear to have any effect.

If I use mpc instead of a webclient, then all is fine up until I terminate Mopidy, at which point I get a different segmentation fault. I think the two seg faults are related since I found that changing PlaylistsController.get_playlists to include_tracks=False fixed everything and there were no seg faults in either scenario.

So my current best guess is this somehow related to the sp_playlist reference in a PlaylistTrack. Or that could be a red herring...

@jodal
Member
jodal commented Aug 4, 2015

This sounds fantastic. Sounds very much like something not too hard to fix. I'll have a look at this right away :-)

@jodal jodal added the bug label Aug 4, 2015
@jodal jodal added this to the v2.0 milestone Aug 4, 2015
@jodal jodal self-assigned this Aug 4, 2015
@trygveaa
Member
trygveaa commented Aug 4, 2015

I get the same segfault, or at least a very similar one (http://ix.io/k6i), when sending "status\nlsinfo" and sometimes when sending just "lsinfo" to the MPD interface. The lsinfo command has to be without arguments or with just / as the argument. It doesn't happen if I give another argument to lsinfo, I guess because it doesn't load the playlists then.

I tried running mopidy with a pdb breakpoint in get_starred and stepped through the code until I got to the segfault. Not sure if it helps, but here's the output: http://ix.io/k6j

@jodal jodal added a commit to mopidy/pyspotify that referenced this issue Aug 5, 2015
@jodal jodal playlist: Fix double release of playlists retrieved by URI
May fix segfault reported in mopidy/mopidy-spotify#60.
2ed3d2a
@jodal
Member
jodal commented Aug 5, 2015

I believe this might have been fixed by mopidy/pyspotify@2ed3d2a.

Can you retest?

@kingosticks
Member

I quickly tested the websocket case and I still get a segfault although it's now slightly different. I have not seen this longer version before.

(gdb) bt
#0  0x0000000000000000 in ?? ()
#1  0x00007f89f3828a8b in sp_session_starred_create () from /usr/lib/libspotify.so.12
#2  0x00007f89f3b46e6c in _cffi_f_sp_session_starred_create (self=<optimised out>, arg0=<_cffi_backend.CData at remote 0x7f89f2b06c60>) at build/temp.linux-x86_64-2.7/spotify._spotify.c:10979
#3  0x000000000052f936 in PyInt_AsUnsignedLongMask (op=()) at ../Objects/intobject.c:277
#4  0x0000000002484fb0 in ?? ()
#5  0x00007f89f3d8b310 in ?? ()
#6  0x00007f89fa8ab578 in ?? ()
#7  0x00000000004d42be in file_dealloc.13342 (f=0x0) at ../Objects/fileobject.c:625
#8  0x00007f89bc000b50 in ?? ()
#9  0x00007f89f3d6b51c in ?? ()
#10 0x00007f89bc000cc8 in ?? ()
#11 0x0000000002be3f70 in ?? ()
#12 0x00007f89f3d8b110 in ?? ()
#13 0x00007f8900000000 in ?? ()
#14 0x00007f89f3d8b0d0 in ?? ()
#15 0x0000000000000000 in ?? ()
@jodal jodal added a commit to mopidy/pyspotify that referenced this issue Aug 5, 2015
@jodal jodal link: Use sp_session_starred_for_user_create to get starred playlists
Our debugging indicates that using a mix of
sp_session_starred_for_user_create(session, username) and
sp_playlist_create(session, link) to get starred playlists consistently
causes segfaults.

May fix segfault reported in mopidy/mopidy-spotify#60.
dab0c67
@jodal
Member
jodal commented Aug 5, 2015

mopidy/pyspotify@dab0c67 adds another potential fix to this.

Please retest! :-)

@kingosticks
Member

So far so good!

@jodal
Member
jodal commented Aug 5, 2015

Ok, then we close this :-)

@jodal jodal closed this Aug 5, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment