Page MenuHomePhabricator

Fix errorred state for missing rev_ids
Closed, ResolvedPublic

Description

Looks like this is a regression in ORES. When an rev_id can't be found, it fully errors rather than returning other scores.

Event Timeline

Halfak created this task.Apr 25 2017, 4:18 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptApr 25 2017, 4:18 PM
Halfak claimed this task.Apr 25 2017, 4:18 PM

wow! Ran into a crazy one. Check this one. Currently, if I request https://ores-staging.wmflabs.org/v3/scores/fiwiki/?revids=324230|2342342352352, I get

{
  "error": {
    "code": "internal server error",
    "message": "Traceback (most recent call last):\n  File \"./ores/wsgi/routes/v3/scores.py\", line 25, in process_score_request\n    return util.format_v3_score_response(score_response)\n  File \"./ores/wsgi/routes/v3/util.py\", line 64, in format_v3_score_response\n    return jsonify({response.context.name: context_doc})\n  File \"/srv/ores/venv/lib/python3.4/site-packages/flask_jsonpify.py\", line 77, in jsonpify\n    return current_app.response_class(__pad(__dumps(*args, **kwargs)),\n  File \"/srv/ores/venv/lib/python3.4/site-packages/flask_jsonpify.py\", line 30, in __dumps\n    indent=indent)\n  File \"/srv/ores/venv/lib/python3.4/site-packages/flask/json.py\", line 126, in dumps\n    rv = _json.dumps(obj, **kwargs)\n  File \"/usr/lib/python3.4/json/__init__.py\", line 237, in dumps\n    **kw).encode(obj)\n  File \"/usr/lib/python3.4/json/encoder.py\", line 194, in encode\n    chunks = list(chunks)\n  File \"/usr/lib/python3.4/json/encoder.py\", line 422, in _iterencode\n    yield from _iterencode_dict(o, _current_indent_level)\n  File \"/usr/lib/python3.4/json/encoder.py\", line 396, in _iterencode_dict\n    yield from chunks\n  File \"/usr/lib/python3.4/json/encoder.py\", line 396, in _iterencode_dict\n    yield from chunks\n  File \"/usr/lib/python3.4/json/encoder.py\", line 345, in _iterencode_dict\n    items = sorted(dct.items(), key=lambda kv: kv[0])\nTypeError: unorderable types: int() < str()\n"
  }
}

This is due to this bug: https://bugs.python.org/issue25457

I'm working on a custom JSON encoder as a work-around.

Halfak closed this task as Resolved.Jun 5 2017, 5:07 PM