liesen/spotify-api-server — Issue #10: Segfault when trying to patch more than one playlist
Author: tom-martin
Created: 2011-11-16 09:58:33+00:00
State: open

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

I'm hitting it with the following python script:

```python
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)
```

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.