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
Fix sf_open error checking when used concurrently #279
Conversation
Thanks for the PR. The behavior of It would probably be helpful for future readers of the code to include the above-mentioned |
So, we made some progress in libsndfile#610 but I think we should merge this anyway as it is "more correct" this way. |
Oh wow, Python 2.6 still supported... will have to adapt that test |
Btw, why aren't Travis results shown here? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the updates!
Good question, I don't know, but I've also seen the effect on several of my projects. In case someone wants to see them, there are the Travis-CI logs: https://travis-ci.org/github/bastibe/SoundFile/pull_requests |
Anything preventing this from being merged? |
libsndfile error reporting is not thread safe, see libsndfile/libsndfile#279 libsndfile/libsndfile#610.
The patch does not attempt to fix that, but it changes the way errors are checked for in order to fix one specific race condition:
If opening a file not understood by libsndfile with
sf.SoundFile
, and then attempting to.read()
from it, sometimes opening the file withsf.SoundFile
does not report an error (due to the libsndfile race condition), and then the.read()
fails. (As a consequence, librosa will not attempt to open the file usingaudioread
, makinglibrosa.load
fail.)