globocom / hlsclient

Python HLS Client
Other
105 stars 21 forks source link

Fix several bug with `tempfile.mkstemp()` and open file descriptors #34

Closed hltbra closed 11 years ago

hltbra commented 11 years ago

At the moment we have a hidden bug with tempfile.mkstemp(), because it opens a file descriptor and return a tuple with an open file descriptor and the temp file path.

More details on how to fix it: http://www.logilab.org/blogentry/17873

From our logs:

Traceback (most recent call last):
  File "/opt/generic/python27/lib/python2.7/site-packages/hlsclient/__main__.py", line 39, in main
  File "/opt/generic/python27/lib/python2.7/site-packages/hlsclient/discover.py", line 31, in discover_playlists
  File "/opt/generic/python27/lib/python2.7/site-packages/hlsclient/discover.py", line 39, in _get_streams_from_url
  File "/opt/generic/python27/lib/python2.7/urllib2.py", line 126, in urlopen
  File "/opt/generic/python27/lib/python2.7/urllib2.py", line 400, in open
  File "/opt/generic/python27/lib/python2.7/urllib2.py", line 418, in _open
  File "/opt/generic/python27/lib/python2.7/urllib2.py", line 378, in _call_chain
  File "/opt/generic/python27/lib/python2.7/urllib2.py", line 1207, in http_open
  File "/opt/generic/python27/lib/python2.7/urllib2.py", line 1177, in do_open
URLError: <urlopen error [Errno 24] Too many open files>