l3uddz / traktarr

Script to add new series & movies to Sonarr/Radarr based on Trakt lists.
GNU General Public License v3.0
586 stars 53 forks source link

Timeout on manual run #134

Open kahn10 opened 4 years ago

kahn10 commented 4 years ago

Traktarr appears to be able to communicate with Radarr and Sonarr, but times out when getting list. The same problem occurred on both a docker running on the same server and on a separate server running traktarr natively.

Config

{
  "automatic": {
    "movies": {
      "anticipated": 100,
      "boxoffice": 100,
      "interval": 20,
      "popular": 100,
      "trending": 100
    },
    "shows": {
      "anticipated": 100,
      "interval": 48,
      "popular": 100,
      "trending": 100
    }
  },
  "core": {
    "debug": false
  },
  "filters": {
    "movies": {
      "allowed_countries": [],
      "allowed_languages": [],
      "blacklisted_genres": [],
      "blacklisted_max_runtime": 0,
      "blacklisted_max_year": 2020,
      "blacklisted_min_runtime": 40,
      "blacklisted_min_year": 1950,
      "blacklisted_title_keywords": [],
      "blacklisted_tmdb_ids": [],
      "disabled_for": [],
      "rotten_tomatoes": ""
    },
    "shows": {
      "allowed_countries": [],
      "allowed_languages": [],
      "blacklisted_genres": [],
      "blacklisted_max_runtime": 0,
      "blacklisted_max_year": 2020,
      "blacklisted_min_runtime": 8,
      "blacklisted_min_year": 1950,
      "blacklisted_networks": [],
      "blacklisted_title_keywords": [],
      "blacklisted_title_keywords": [],
      "blacklisted_tmdb_ids": [],
      "disabled_for": [],
      "rotten_tomatoes": ""
    },
    "shows": {
      "allowed_countries": [],
      "allowed_languages": [],
      "blacklisted_genres": [],
      "blacklisted_max_runtime": 0,
      "blacklisted_max_year": 2020,
      "blacklisted_min_runtime": 8,
      "blacklisted_min_year": 1950,
      "blacklisted_networks": [],
      "blacklisted_title_keywords": [],
      "blacklisted_tvdb_ids": [],
      "disabled_for": []
    }
  },
  "notifications": {
    "verbose": true
  },
  "omdb": {
    "api_key": ""
  },
  "radarr": {
    "api_key": "xxxxx",
    "minimum_availability": "released",
    "quality": "HD or UHD",
    "root_folder": "/trans-temp/post-trans/Movies - Radarr",
    "url": "http://docker.for.mac.host.internal:7878/"
  },
  "sonarr": {
    "api_key": "xxxxx",
    "language": "English",
    "quality": "HD and UHD",
    "root_folder": "/trans-temp/post-trans/TV Shows - Organized",
    "tags": {},
    "url": "http://docker.for.mac.host.internal:8989/"
  },
  "trakt": {
    "client_id": "xxxxx",
    "client_secret": "xxxxx"
  }
}
2020-07-15 15:26:30,800 - INFO       - Traktarr                            - validate_trakt                      - Validating Trakt API Key...
2020-07-15 15:26:30,806 - INFO       - media.trakt                         - _headers                            - No user
2020-07-15 15:26:30,919 - INFO       - Traktarr                            - validate_trakt                      - ...Validated Trakt API Key.
2020-07-15 15:26:31,021 - INFO       - Traktarr                            - validate_pvr                        - Validated Radarr URL & API Key.
2020-07-15 15:26:31,148 - INFO       - Traktarr                            - get_quality_profile_id              - Retrieved Quality Profile ID for 'HD or UHD': 7
2020-07-15 15:27:31,156 - ERROR      - media.pvr                           - _get_objects                        - Exception retrieving objects:
Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/urllib3/connectionpool.py", line 384, in _make_request
    six.raise_from(e, None)
  File "<string>", line 2, in raise_from
  File "/usr/lib/python3.8/site-packages/urllib3/connectionpool.py", line 380, in _make_request
    httplib_response = conn.getresponse()
  File "/usr/lib/python3.8/http/client.py", line 1322, in getresponse
    response.begin()
  File "/usr/lib/python3.8/http/client.py", line 303, in begin
    version, status, reason = self._read_status()
  File "/usr/lib/python3.8/http/client.py", line 264, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "/usr/lib/python3.8/socket.py", line 669, in readinto
    return self._sock.recv_into(b)
socket.timeout: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/requests/adapters.py", line 439, in send
    resp = conn.urlopen(
  File "/usr/lib/python3.8/site-packages/urllib3/connectionpool.py", line 637, in urlopen
    retries = retries.increment(method, url, error=e, _pool=self,
  File "/usr/lib/python3.8/site-packages/urllib3/util/retry.py", line 368, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/usr/lib/python3.8/site-packages/urllib3/packages/six.py", line 686, in reraise
    raise value
  File "/usr/lib/python3.8/site-packages/urllib3/connectionpool.py", line 597, in urlopen
    httplib_response = self._make_request(conn, method, url,
  File "/usr/lib/python3.8/site-packages/urllib3/connectionpool.py", line 386, in _make_request
    self._raise_timeout(err=e, url=url, timeout_value=read_timeout)
  File "/usr/lib/python3.8/site-packages/urllib3/connectionpool.py", line 306, in _raise_timeout
    raise ReadTimeoutError(self, url, "Read timed out. (read timeout=%s)" % timeout_value)
urllib3.exceptions.ReadTimeoutError: HTTPConnectionPool(host='docker.for.mac.host.internal', port=7878): Read timed out. (read timeout=60)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/traktarr/media/pvr.py", line 51, in _get_objects
    req = requests.get(
  File "/usr/lib/python3.8/site-packages/requests/api.py", line 75, in get
    return request('get', url, params=params, **kwargs)
  File "/usr/lib/python3.8/site-packages/requests/api.py", line 60, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/lib/python3.8/site-packages/requests/sessions.py", line 533, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/lib/python3.8/site-packages/requests/sessions.py", line 646, in send
    r = adapter.send(request, **kwargs)
  File "/usr/lib/python3.8/site-packages/requests/adapters.py", line 529, in send
    raise ReadTimeout(e, request=request)
requests.exceptions.ReadTimeout: HTTPConnectionPool(host='docker.for.mac.host.internal', port=7878): Read timed out. (read timeout=60)
2020-07-15 15:27:31,170 - WARNING    - helpers.misc                        - backoff_handler                     - Backing off 0.4 seconds afters 1 tries calling function <function PVR._get_objects at 0x7fcebf2eb1f0> with args (<media.radarr.Radarr object at 0x7fcebf32bf40>, 'api/movie') and kwargs {}
^[[A2020-07-15 15:28:31,619 - ERROR      - media.pvr                           - _get_objects                        - Exception retrieving objects:
Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/urllib3/connectionpool.py", line 384, in _make_request
    six.raise_from(e, None)
  File "<string>", line 2, in raise_from
  File "/usr/lib/python3.8/site-packages/urllib3/connectionpool.py", line 380, in _make_request
    httplib_response = conn.getresponse()
  File "/usr/lib/python3.8/http/client.py", line 1322, in getresponse
    response.begin()
  File "/usr/lib/python3.8/http/client.py", line 303, in begin
    version, status, reason = self._read_status()
  File "/usr/lib/python3.8/http/client.py", line 264, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "/usr/lib/python3.8/socket.py", line 669, in readinto
    return self._sock.recv_into(b)
socket.timeout: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/requests/adapters.py", line 439, in send
    resp = conn.urlopen(
  File "/usr/lib/python3.8/site-packages/urllib3/connectionpool.py", line 637, in urlopen
    retries = retries.increment(method, url, error=e, _pool=self,
  File "/usr/lib/python3.8/site-packages/urllib3/util/retry.py", line 368, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/usr/lib/python3.8/site-packages/urllib3/packages/six.py", line 686, in reraise
    raise value
  File "/usr/lib/python3.8/site-packages/urllib3/connectionpool.py", line 597, in urlopen
    httplib_response = self._make_request(conn, method, url,
  File "/usr/lib/python3.8/site-packages/urllib3/connectionpool.py", line 386, in _make_request
    self._raise_timeout(err=e, url=url, timeout_value=read_timeout)
  File "/usr/lib/python3.8/site-packages/urllib3/connectionpool.py", line 306, in _raise_timeout
    raise ReadTimeoutError(self, url, "Read timed out. (read timeout=%s)" % timeout_value)
urllib3.exceptions.ReadTimeoutError: HTTPConnectionPool(host='docker.for.mac.host.internal', port=7878): Read timed out. (read timeout=60)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/traktarr/media/pvr.py", line 51, in _get_objects
    req = requests.get(
  File "/usr/lib/python3.8/site-packages/requests/api.py", line 75, in get
    return request('get', url, params=params, **kwargs)
  File "/usr/lib/python3.8/site-packages/requests/api.py", line 60, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/lib/python3.8/site-packages/requests/sessions.py", line 533, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/lib/python3.8/site-packages/requests/sessions.py", line 646, in send
    r = adapter.send(request, **kwargs)
  File "/usr/lib/python3.8/site-packages/requests/adapters.py", line 529, in send
    raise ReadTimeout(e, request=request)
requests.exceptions.ReadTimeout: HTTPConnectionPool(host='docker.for.mac.host.internal', port=7878): Read timed out. (read timeout=60)
2020-07-15 15:28:31,629 - WARNING    - helpers.misc                        - backoff_handler                     - Backing off 1.2 seconds afters 2 tries calling function <function PVR._get_objects at 0x7fcebf2eb1f0> with args (<media.radarr.Radarr object at 0x7fcebf32bf40>, 'api/movie') and kwargs {}
WildWayz commented 4 years ago

I'm also getting this a lot. Same errors as you

kahn10 commented 4 years ago

This continues to be an issue.

hpearson commented 3 years ago

After some research, I was able to resolve the issue for me. Radarr was CPU throttled causing the Traktarr timeout waiting for the response.

C42EFF4Lbb54dwg commented 3 years ago

After some research, I was able to resolve the issue for me. Radarr was CPU throttled causing the Traktarr timeout waiting for the response.

how did you resolve the issue?

hpearson commented 3 years ago

After some research, I was able to resolve the issue for me. Radarr was CPU throttled causing the Traktarr timeout waiting for the response.

how did you resolve the issue?

Radarr wasn't fast enough to reply in a timely manner causing the timeout. I had Portainer limit Radarr to .25% of 1 processor core, for me I was able to resolve it by upping the limit to use 1 whole core. That gave my Radarr docker container enough hours power to complete the lookup before the cut-off.

If you are unable to boost Radarr CPU speed try to reduce the CPU load the best you can. The processing power needed scales with the number of movies handled by Radarr so it is possible to 'over-expand' your hardware. (This is what happened to my docker container)