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

sp_session_starred_create segmentation fault #60

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

sp_session_starred_create segmentation fault #60

kingosticks opened this issue Aug 4, 2015 · 7 comments
Assignees
Labels
C-bug Category: This is a bug
Milestone

Comments

@kingosticks
Copy link
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
Copy link
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 C-bug Category: This is a 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
Copy link
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 added a commit to jodal/pyspotify that referenced this issue Aug 5, 2015
@jodal
Copy link
Member

jodal commented Aug 5, 2015

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

Can you retest?

@kingosticks
Copy link
Member Author

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 added a commit to jodal/pyspotify that referenced this issue Aug 5, 2015
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.
@jodal
Copy link
Member

jodal commented Aug 5, 2015

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

Please retest! :-)

@kingosticks
Copy link
Member Author

So far so good!

@jodal
Copy link
Member

jodal commented Aug 5, 2015

Ok, then we close this :-)

@jodal jodal closed this as completed Aug 5, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug
Projects
None yet
Development

No branches or pull requests

3 participants