guidopetri / chess-pipeline

Pulling games from the Lichess API into a PostgreSQL database for data analysis.
GNU General Public License v3.0
20 stars 2 forks source link

Connection error #31

Closed guidopetri closed 4 years ago

guidopetri commented 4 years ago

Got a weird connection error from the pipeline this morning. Traceback:

Runtime error:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 601, in urlopen
    chunked=chunked)
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 346, in _make_request
    self._validate_conn(conn)
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 852, in _validate_conn
    conn.connect()
  File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 337, in connect
    cert = self.sock.getpeercert()
  File "/usr/lib/python3.7/ssl.py", line 953, in getpeercert
    self._check_connected()
  File "/usr/lib/python3.7/ssl.py", line 918, in _check_connected
    self.getpeername()
OSError: [Errno 107] Transport endpoint is not connected

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home//.local/lib/python3.7/site-packages/requests/adapters.py", line 449, in send
    timeout=timeout
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 639, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/usr/lib/python3/dist-packages/urllib3/util/retry.py", line 367, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/home//.local/lib/python3.7/site-packages/six.py", line 702, in reraise
    raise value.with_traceback(tb)
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 601, in urlopen
    chunked=chunked)
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 346, in _make_request
    self._validate_conn(conn)
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 852, in _validate_conn
    conn.connect()
  File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 337, in connect
    cert = self.sock.getpeercert()
  File "/usr/lib/python3.7/ssl.py", line 953, in getpeercert
    self._check_connected()
  File "/usr/lib/python3.7/ssl.py", line 918, in _check_connected
    self.getpeername()
urllib3.exceptions.ProtocolError: ('Connection aborted.', OSError(107, 'Transport endpoint is not connected'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home//.local/lib/python3.7/site-packages/luigi/worker.py", line 199, in run
    new_deps = self._run_get_new_deps()
  File "/home//.local/lib/python3.7/site-packages/luigi/worker.py", line 141, in _run_get_new_deps
    task_gen = self.task.run()
  File "/home//Git/chess-pipeline/chess_pipeline.py", line 91, in run
    format=PYCHESS)
  File "/home//.local/lib/python3.7/site-packages/lichess/api.py", line 281, in user_games
    return _api_get('/api/games/user/{}'.format(username), kwargs, object_type=lichess.format.GAME_STREAM_OBJECT)
  File "/home//.local/lib/python3.7/site-packages/lichess/api.py", line 108, in _api_get
    return client.call(path, params, auth=auth, format=format, object_type=object_type)
  File "/home//.local/lib/python3.7/site-packages/lichess/api.py", line 73, in call
    resp = requests.get(url, params, headers=headers, cookies=cookies, stream=stream)
  File "/home//.local/lib/python3.7/site-packages/requests/api.py", line 76, in get
    return request('get', url, params=params, **kwargs)
  File "/home//.local/lib/python3.7/site-packages/requests/api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "/home//.local/lib/python3.7/site-packages/requests/sessions.py", line 530, in request
    resp = self.send(prep, **send_kwargs)
  File "/home//.local/lib/python3.7/site-packages/requests/sessions.py", line 643, in send
    r = adapter.send(request, **kwargs)
  File "/home//.local/lib/python3.7/site-packages/requests/adapters.py", line 498, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', OSError(107, 'Transport endpoint is not connected'))

I suspect this is actually related to Lichess downtime, but I'd like to make sure.

guidopetri commented 4 years ago

Looks like this might have indeed been a Lichess issue:

https://lichess.org/forum/lichess-feedback/lichess-just-got-lagged-after-restarting

The time matches up with the time I ran the pipeline. I'm missing siddhartha13 bullet and Grahtbo blitz games from yesterday, so I should re-run those.

guidopetri commented 4 years ago

All caught up.

guidopetri commented 4 years ago

I could possibly write in a try/except catch for this (or similar), but I don't think this is a common occurrence - neither would it be any more useful to have a try/except than for it to just fail, I don't think.

guidopetri commented 4 years ago

This just happened again at 2:31am EST. :/