Join GitHub today
Sporadic crash during iterative search queries #121
Seeing the following crash in the python wrapper from an application I have written that is performing a number of iterative search queries:
From callback <function _search_complete_callback at 0x103ad70>: Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/spotify/search.py", line 308, in _search_complete_callback search_result._callback_handles.remove(handle) AttributeError: '_cffi_backend.CData' object has no attribute '_callback_handles'
I took a look at the code and couldn't see an obvious way by which the class could be initialized without the
However, I do wonder if there is a possibility that an invalid handle could be returned by the C library in the following code fragment:
(callback, search_result) = ffi.from_handle(handle)
Any thoughts on this would be appreciated.
I was suspecting this could happen, as you can see from some of my remaining TODOs, ref. https://github.com/mopidy/pyspotify/blob/v2.x/develop/spotify/search.py#L57-L59. I'll leave this open until I've tried to address it and make this safe.
Yes, I saw that. Thanks for the reply. Basically, in this instance, my search timed out and the search object was no longer being referenced. I think it's an easy fix, by the way, just to add a try/except around the code in the callback routine, which tries to remove the callback handle from the set, and just ride the exception out.