Page MenuHomePhabricator

Respond with useful error information with all recoverable errors
Closed, ResolvedPublic

Description

The following error showed up in the logs in production. ORES responded with a gross 500 error. We should be able to catch this error and report it to the user with some JSON.

Traceback (most recent call last):
  File "/srv/deployment/ores/venv/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py", line 378, in _make_request
    httplib_response = conn.getresponse()
  File "/usr/lib/python3.4/http/client.py", line 1172, in getresponse
    response.begin()
  File "/usr/lib/python3.4/http/client.py", line 351, in begin
    version, status, reason = self._read_status()
  File "/usr/lib/python3.4/http/client.py", line 313, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "/usr/lib/python3.4/socket.py", line 371, in readinto
    return self._sock.recv_into(b)
  File "/usr/lib/python3.4/ssl.py", line 745, in recv_into
    return self.read(nbytes, buffer)
  File "/usr/lib/python3.4/ssl.py", line 617, in read
    v = self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/srv/deployment/ores/venv/lib/python3.4/site-packages/requests/adapters.py", line 376, in send
    timeout=timeout
  File "/srv/deployment/ores/venv/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py", line 609, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/srv/deployment/ores/venv/lib/python3.4/site-packages/requests/packages/urllib3/util/retry.py", line 247, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/srv/deployment/ores/venv/lib/python3.4/site-packages/requests/packages/urllib3/packages/six.py", line 310, in reraise
    raise value
  File "/srv/deployment/ores/venv/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py", line 559, in urlopen
    body=body, headers=headers)
  File "/srv/deployment/ores/venv/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py", line 380, in _make_request
    self._raise_timeout(err=e, url=url, timeout_value=read_timeout)
  File "/srv/deployment/ores/venv/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py", line 308, in _raise_timeout
    raise ReadTimeoutError(self, url, "Read timed out. (read timeout=%s)" % timeout_value)
requests.packages.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='pl.wikipedia.org', port=443): Read timed out. (read timeout=5.0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/srv/deployment/ores/venv/lib/python3.4/site-packages/mwapi/session.py", line 76, in _request
    stream=True)
  File "/srv/deployment/ores/venv/lib/python3.4/site-packages/requests/sessions.py", line 468, in request
    resp = self.send(prep, **send_kwargs)
  File "/srv/deployment/ores/venv/lib/python3.4/site-packages/requests/sessions.py", line 576, in send
    r = adapter.send(request, **kwargs)
  File "/srv/deployment/ores/venv/lib/python3.4/site-packages/requests/adapters.py", line 449, in send
    raise ReadTimeout(e, request=request)
requests.exceptions.ReadTimeout: HTTPSConnectionPool(host='pl.wikipedia.org', port=443): Read timed out. (read timeout=5.0)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/srv/deployment/ores/venv/lib/python3.4/site-packages/flask/app.py", line 1817, in wsgi_app
    response = self.full_dispatch_request()
  File "/srv/deployment/ores/venv/lib/python3.4/site-packages/flask/app.py", line 1477, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/srv/deployment/ores/venv/lib/python3.4/site-packages/flask/app.py", line 1381, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/srv/deployment/ores/venv/lib/python3.4/site-packages/flask/_compat.py", line 33, in reraise
    raise value
  File "/srv/deployment/ores/venv/lib/python3.4/site-packages/flask/app.py", line 1475, in full_dispatch_request
    rv = self.dispatch_request()
  File "/srv/deployment/ores/venv/lib/python3.4/site-packages/flask/app.py", line 1461, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "./ores/wsgi/routes/v1/scores.py", line 105, in score_revisions
    precache=precache)
  File "./ores/score_processors/score_processor.py", line 32, in score
    include_features=include_features)
  File "./ores/score_processors/celery.py", line 177, in _score
    include_features=include_features)
  File "./ores/score_processors/celery.py", line 95, in _score_in_celery
    caches=caches)
  File "./ores/score_processors/score_processor.py", line 60, in _get_root_ds
    roots = scoring_context.extract_roots(model, rev_ids, caches=caches)
  File "./ores/scoring_contexts/scoring_context.py", line 100, in extract_roots
    for rev_id, (error, root_vals) in zip(rev_ids, error_root_vals):
  File "/srv/deployment/ores/venv/lib/python3.4/site-packages/revscoring/extractors/api/extractor.py", line 123, in _extract_many
    rev_docs = self.get_rev_doc_map(revids_to_lookup, rvprop=rvprop)
  File "/srv/deployment/ores/venv/lib/python3.4/site-packages/revscoring/extractors/api/extractor.py", line 230, in get_rev_doc_map
    return {rd['revid']: rd for rd in rev_docs}
  File "/srv/deployment/ores/venv/lib/python3.4/site-packages/revscoring/extractors/api/extractor.py", line 230, in <dictcomp>
    return {rd['revid']: rd for rd in rev_docs}
  File "/srv/deployment/ores/venv/lib/python3.4/site-packages/revscoring/extractors/api/extractor.py", line 240, in query_revisions_by_revids
    revids=batch_ids, **params)
  File "/srv/deployment/ores/venv/lib/python3.4/site-packages/mwapi/session.py", line 157, in get
    return self._request('GET', self._normalize_params(params))
  File "/srv/deployment/ores/venv/lib/python3.4/site-packages/mwapi/session.py", line 78, in _request
    raise TimeoutError(str(e)) from e
mwapi.errors.TimeoutError: HTTPSConnectionPool(host='pl.wikipedia.org', port=443): Read timed out. (read timeout=5.0)

Event Timeline

Halfak created this task.Jul 13 2016, 8:30 PM
Restricted Application added subscribers: Zppix, Aklapper. · View Herald TranscriptJul 13 2016, 8:30 PM

See T140302 for the specific request that caused the timeout error.

Halfak claimed this task.Jul 13 2016, 9:12 PM

https://github.com/wiki-ai/ores/pull/158

The error is still gross, but it is more useful than the bare 500.

Ladsgroup closed this task as Resolved.Jul 18 2016, 9:09 PM