Skip to content
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

SSLError: ('The read operation timed out',) #1219

Closed
fernandog opened this issue Oct 3, 2016 · 4 comments
Closed

SSLError: ('The read operation timed out',) #1219

fernandog opened this issue Oct 3, 2016 · 4 comments
Milestone

Comments

@fernandog
Copy link
Contributor

@ratoaq2 is there something we can do about this?

2016-10-03 01:30:30 WARNING  FINDSUBTITLES :: [c750397] Unexpected error in provider 'opensubtitles'
Traceback (most recent call last):
  File "/home/osmc/SickRage/lib/subliminal/core.py", line 118, in list_subtitles_provider
    return self[provider].list_subtitles(video, provider_languages)
  File "/home/osmc/SickRage/lib/subliminal/providers/opensubtitles.py", line 265, in list_subtitles
    query=query, season=season, episode=episode, tag=os.path.basename(video.name))
  File "/home/osmc/SickRage/lib/subliminal/providers/opensubtitles.py", line 180, in f_retry
    return f(*args, **kwargs)
  File "/home/osmc/SickRage/lib/subliminal/providers/opensubtitles.py", line 216, in query
    response = checked(self.server.SearchSubtitles(self.token, criteria))
  File "/usr/lib/python2.7/xmlrpclib.py", line 1233, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib/python2.7/xmlrpclib.py", line 1591, in __request
    verbose=self.__verbose
  File "/usr/lib/python2.7/xmlrpclib.py", line 1273, in request
    return self.single_request(host, handler, request_body, verbose)
  File "/usr/lib/python2.7/xmlrpclib.py", line 1303, in single_request
    response = h.getresponse(buffering=True)
  File "/usr/lib/python2.7/httplib.py", line 1111, in getresponse
    response.begin()
  File "/usr/lib/python2.7/httplib.py", line 444, in begin
    version, status, reason = self._read_status()
  File "/usr/lib/python2.7/httplib.py", line 400, in _read_status
    line = self.fp.readline(_MAXLINE + 1)
  File "/usr/lib/python2.7/socket.py", line 476, in readline
    data = self._sock.recv(self._rbufsize)
  File "/usr/lib/python2.7/ssl.py", line 714, in recv
    return self.read(buflen)
  File "/usr/lib/python2.7/ssl.py", line 608, in read
    v = self._sslobj.read(len or 1024)
SSLError: ('The read operation timed out',)
@duramato
Copy link
Contributor

INFO

Python Version: 2.7.9 (default, Sep 17 2016, 20:26:04) [GCC 4.9.2]
Operating System: Linux-4.4.38-v7+-armv7l-with-debian-8.0
Locale: UTF-8
Branch: develop
Database: 44.5
Commit: 6fb38a6
Link to Log: https://gist.github.com/a42e5419005b8b0ff25a55a6136b09bf

ERROR

2017-02-24 15:24:39 ERROR    FINDSUBTITLES :: [6fb38a6] Unable to find subtitles for Training Day S01E04. Error: The read operation timed out
Traceback (most recent call last):
  File "/home/pi/Medusa/medusa/subtitles.py", line 1031, in run
    episode_object.download_subtitles()
  File "/home/pi/Medusa/medusa/tv/episode.py", line 272, in download_subtitles
    notifiers.notify_subtitle_download(self.pretty_name(), subtitle_list)
  File "/home/pi/Medusa/medusa/notifiers/__init__.py", line 82, in notify_subtitle_download
    n.notify_subtitle_download(ep_name, lang)
  File "/home/pi/Medusa/medusa/notifiers/nma.py", line 25, in notify_subtitle_download
    message=ep_name + ": " + lang)
  File "/home/pi/Medusa/medusa/notifiers/nma.py", line 62, in _sendNMA
    response = p.push(application=title, event=event, description=message, priority=nma_priority, batch_mode=batch)
  File "/home/pi/Medusa/lib/pynma/pynma.py", line 106, in push
    res = self.callapi('POST', ADD_PATH, datas)
  File "/home/pi/Medusa/lib/pynma/pynma.py", line 120, in callapi
    resp = http_handler.getresponse()
  File "/usr/lib/python2.7/httplib.py", line 1111, in getresponse
    response.begin()
  File "/usr/lib/python2.7/httplib.py", line 444, in begin
    version, status, reason = self._read_status()
  File "/usr/lib/python2.7/httplib.py", line 400, in _read_status
    line = self.fp.readline(_MAXLINE + 1)
  File "/usr/lib/python2.7/socket.py", line 476, in readline
    data = self._sock.recv(self._rbufsize)
  File "/usr/lib/python2.7/ssl.py", line 714, in recv
    return self.read(buflen)
  File "/usr/lib/python2.7/ssl.py", line 608, in read
    v = self._sslobj.read(len or 1024)
SSLError: ('The read operation timed out',)

STAFF NOTIFIED: @pymedusa/support @pymedusa/moderators

@ratoaq2
Copy link
Contributor

ratoaq2 commented Feb 24, 2017

Yes, remove these broad try/except:

logger.error(u'Unable to find subtitles for %s %s. Error: %s',

the thread loop that executes should be the only place with a broad catch and using exception handler to log the exception. That way we can easily handle each exception type in a proper way and in a single place

@labrys
Copy link
Contributor

labrys commented Feb 24, 2017

Exception handling should be targeted and specific. It should wrap the minimum lines of exceptional code and check only for the exceptions expected.

@duramato duramato reopened this Feb 24, 2017
@fernandog
Copy link
Contributor Author

fernandog commented Feb 24, 2017

@ratoaq2 that exception is inside a loop. so if one fails, it will continue to download another

Is there another way instead of removing it so it can continue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants