Burgestrand / Hallon

Hallon is currently **UNMAINTAINED**.
http://rdoc.info/github/Burgestrand/Hallon/master/frames
134 stars 12 forks source link

Abort trap 6 and Segmentation fault issues when switching users #133

Closed xbora closed 12 years ago

xbora commented 12 years ago

Hi there.

First of all, thanks for creating this gem, it looks like you put tons of work into it and it is really appreciated.

I'm having a hard time with it however as I keep getting

"Abort trap: 6"

and on other occasions

/app/vendor/bundle/ruby/1.9.1/gems/spotify-12.3.0/lib/spotify.rb:99: [BUG] Segmentation fault ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-linux]

-- control frame ---------- c:0062 p:---- s:0228 b:0228 l:000227 d:000227 CFUNC :playlistcontainer_release c:0061 p:0020 s:0224 b:0224 l:000218 d:000223 BLOCK /app/vendor/bundle/ruby/1.9.1/gems/spotify-12.3.0/lib/spotify.rb:99

errors when I'm switching users.

The gist here: https://gist.github.com/3801461 is my library that I use in a background job for our users to update their recent spotify listens based on their starred tracks and playlists. So in the job it logs one user in gets the playlist and starred tracks, then logs that user out logs another user in etc.

The methods I have in the gist work fine for the first user but once I do the log out and log the second user in, I start getting the errors I mention above.

Am I doing something wrong in my code or is there a bug somewhere?

I use ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin11.2.0] run this on heroku and also gem directly from the repo

gem 'hallon', github: 'Burgestrand/Hallon'

Thank you for your time.

Best, Bora

Burgestrand commented 12 years ago

This might be a symptom of user switching, but I’m not sure. My initial thought was that after logging a user out, important internal information related to the starred playlist is cleared away — it would make sense, considering the playlist is not valid any more. Attempts to play around with it, such as trying to garbage clean it (which spotify does automatically), might cause libspotify to crash. This theory is hard to test, and my naive tries to crash libspotify this way by logging in, creating the playlist, logging out, and releasing it, did not prove fruitful.

For debugging purposes, spotify (gem) will print out information during garbage release if ruby is in debug mode. You can activate this by starting ruby with the -d flag, or setting $DEBUG = true. It will print the relevant code being run right before the crash as the result of playlistcontainer_release.

Additionally, if you set the tracefile option when initializing your session, you’ll receive a log of all libspotify calls being placed, in the tracefile. It might help tracking the issue down.

Keep in mind I have not been using Hallon with multiple sessions personally. This is completely uncharted territory.

xbora commented 12 years ago

Hi Kim, thanks for the quick response. After reading your explanation, I have decided that I'm not willing to die on the hills for pursuing this issue, as a former colleague used to say, so I changed my approach. Instead of making back to back calls in a batch job, I will tie the calls to delayed user actions from the app. I tested that approach this morning and seems to work without issues.

Thanks again for being so attentive.

Burgestrand commented 12 years ago

I cannot say I understand your approach, but I am glad that you found a workaround. Closing this issue as WONTFIX for now, as I plan to change large parts of Hallon (once I am done with major changes to spotify gem) and this issue is no longer part of the scope. If you run into any more issues however, I’ll be glad to help.