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

Improve error handling on 5xx-error with async-client #926

Open
thomasht86 opened this issue Sep 19, 2024 · 1 comment
Open

Improve error handling on 5xx-error with async-client #926

thomasht86 opened this issue Sep 19, 2024 · 1 comment
Assignees
Milestone

Comments

@thomasht86
Copy link
Collaborator

If 3 retries fails, user may get:

failed: RetryError(<Future at
 0xfffe30231510 state=finished raised JSONDecodeError>)")
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/tenacity/asyncio/__init__.py", line 114, in __call__
    result = await fn(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/vespa/application.py", line 1538, in query
    json=r.json(), status_code=r.status_code, url=str(r.url)
         ^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/httpx/_models.py", line 761, in json
    return jsonlib.loads(self.content, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

which is not very helpful.

Better to check response code first and raise error on 5xx, rather than offloading the error raising to the JSON-decoder.

@thomasht86
Copy link
Collaborator Author

This test also fails intermittently

FAILED tests/integration/test_integration_vespa_cloud.py::TestMsmarcoApplication::test_execute_async_data_operations - urllib3.exceptions.HTTPError: HTTP 502 error: Bad Gateway for /application/v4/tenant/vespa-team/application/pyvespa-integration/instance/msmarco/job/dev-aws-us-east-1c/run/1?after=39

@thomasht86 thomasht86 self-assigned this Sep 25, 2024
@thomasht86 thomasht86 added this to the soon milestone Sep 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant