Fix for cleaning up os calls through Popen #501
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds the same
_del__
code for AudioFileClip as there is for VideoFileClip:https://github.com/Zulko/moviepy/blob/master/moviepy/video/io/VideoFileClip.py#L104
Despite using moviepy master I had problems with readers not being closed (leading to OSError: [Errno 24] Too many open files), similar to:
#57
#255
I have a complicated setup with a server that runs a long time and is multi-threaded (and the issue happens after days). To find and fix the issue I wrote a wrapper around Popen to log the calls opened and closed:
https://gist.github.com/gyglim/340c9d276d7f53578eb9673156e556df
This Pull Request together with explicitly calling
video.__del__()
resolved the issue.Explicitly calling
__del__()
relates to this:http://stackoverflow.com/questions/1481488/what-is-the-del-method-how-to-call-it/1481512#1481512
When calling
__del__()
without the fix in this PR, the readers of AudioFileClip would stay open.