Segfault when trying to patch more than one playlist #10

Closed
tom-martin opened this Issue Nov 16, 2011 · 2 comments

Projects

None yet

2 participants

@tom-martin

Nice work on spotify-api-server. I have a small issue though

I'm hitting it with the following python script:

import urllib2
import json
from time import sleep

for i in range(0, 5):
    response = urllib2.urlopen("http://localhost:1337/playlists", "{\"title\":\"Test playlist " + str(i) + "\"}").read()
    playlist = json.loads(response)
    print playlist["uri"]

    sleep(1)

    response = urllib2.urlopen("http://localhost:1337/playlists/" + playlist["uri"] + "/patch", "[\"spotify:track:4dltreEGGU7sRqNn8mn077\",\"spotify:track:1VuYtK1bj7zobQvVjVXLCM\",\"spotify:track:3MI0YDy3xsC7DMkYMGl8qn\",\"spotify:track:6oVF3nIEWCgHHUgsTNogJy\",\"spotify:track:0KiabThwmeijxTVsCbJoqB\",\"spotify:track:3GVO15Abzaia0MTx4KqnSN\",\"spotify:track:6dj5QpwSilhKjni4tY4q26\",\"spotify:track:2Bd30tORK6MALbPhkPBObr\",\"spotify:track:6ajn6NMyl4qxugyQI5aEjQ\",\"spotify:track:7iIA3j6dE497MxKVDnOgEr\"]").read()

    sleep(1)

On the second iteration of that loop, during the call to /patch spotify-api-server segfaults. I got this backtrace from gdb if that helps:
#0 0xb7cb4408 in svn_diff_output () from /usr/lib/libsvn_diff-1.so.1
#1 0xb7cb33cb in svn_diff_mem_string_output_unified ()

from /usr/lib/libsvn_diff-1.so.1
#2 0x0804acf9 in diff_output_stdout (stream_output=0xb7fd8740,

diff=0xb7748058, playlist=0x84fa5d0, tracks=0x850ade8, num_tracks=10, 
pool=0xb7fd7018) at diff.c:266

#3 0x0804c8d7 in put_playlist_patch (playlist=0x84fa5d0, request=0x850f0e0,

userdata=0x8051008) at server.c:673

#4 0x0804d174 in handle_request (request=0x850f0e0, userdata=0x8051008)

at server.c:900

#5 0xb7c3493f in ?? () from /usr/lib/libevent-2.0.so.5
#6 0xb7c323cf in ?? () from /usr/lib/libevent-2.0.so.5
#7 0xb7c3391c in ?? () from /usr/lib/libevent-2.0.so.5
#8 0xb7c33a63 in ?? () from /usr/lib/libevent-2.0.so.5
#9 0xb7c2120f in _bufferevent_run_readcb () from /usr/lib/libevent-2.0.so.5
#10 0xb7c2268d in ?? () from /usr/lib/libevent-2.0.so.5
#11 0xb7c160c9 in event_base_loop () from /usr/lib/libevent-2.0.so.5
#12 0xb7c172d3 in event_base_dispatch () from /usr/lib/libevent-2.0.so.5
#13 0x0804d773 in main (argc=1, argv=0xbffff384) at server.c:1059

I also had to add -lapr-1 to the server target in the Makefile to get it to build (on Ubuntu 11.10). I don't imagine this is related though.

@liesen
Owner
liesen commented Nov 16, 2011

Could you try to comment out lines 664-666 in server.c (printing the playlist diff). I have had som issues with that before.

I'll look into the build flag as well, thanks.

@tom-martin

Yeah, that seemed to help.

@liesen liesen closed this in 95a33ec Nov 16, 2011
@ppcano ppcano added a commit to ppcano/spotify-api-server that referenced this issue Nov 21, 2011
@ppcano ppcano Merge remote-tracking branch 'upstream/master'
* upstream/master:
  Revert the typecast and re-introduce the compiler warning about type signature mismatch in sp_playlist_callbacks::playlist_update_in_progress (I dont want to be bitten by the void *-cast later)
  Send 400 Bad Request when no route is found for a /user-request
  Fix compiler warning
  Remove unnecessary account struct
  Fix most compiler warnings
  Add preprocessor flags for libapr to makefile
  Link apr in makefile
  Remove lines that output diff in /patch. Closes #10.
  Fix link order of libraries
  Add syslog logging
  Correct order of arguments to handle_user_request. Closes #6.
  Updated README with /user-API
  Add /user/<username>/playlists and /user/<username>/starred to get a users public playlists and starred playlist
  Fix link to libspotify in README
  Upgrade to libspotify-9.
e41f9ca
@tom-martin tom-martin pushed a commit to tom-martin/spotify-api-server that referenced this issue Dec 21, 2011
@liesen Remove lines that output diff in /patch. Closes #10. 3337128
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment