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

Add httpx.WriteError to client retryable exceptions #8145

Merged
merged 2 commits into from
Jan 12, 2023
Merged

Conversation

zanieb
Copy link
Contributor

@zanieb zanieb commented Jan 11, 2023

I think this is similar to a retry on ReadError, but I'm not sure of the additional implications of retrying here.

Example

Crash reported:

Crash detected! Execution was interrupted by an unexpected exception: Traceback (most recent call last):
  File "/usr/local/lib/python3.10/asyncio/selector_events.py", line 924, in write
    n = self._sock.send(data)
BrokenPipeError: [Errno 32] Broken pipe

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

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/httpcore/_exceptions.py", line 10, in map_exceptions
    yield
  File "/usr/local/lib/python3.10/site-packages/httpcore/backends/asyncio.py", line 51, in write
    await self._stream.send(item=buffer)
  File "/usr/local/lib/python3.10/site-packages/anyio/streams/tls.py", line 202, in send
    await self._call_sslobject_method(self._ssl_object.write, item)
  File "/usr/local/lib/python3.10/site-packages/anyio/streams/tls.py", line 168, in _call_sslobject_method
    await self.transport_stream.send(self._write_bio.read())
  File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 1297, in send
    raise self._protocol.exception
anyio.BrokenResourceError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/httpx/_transports/default.py", line 60, in map_httpcore_exceptions
    yield
  File "/usr/local/lib/python3.10/site-packages/httpx/_transports/default.py", line 353, in handle_async_request
    resp = await self._pool.handle_async_request(req)
  File "/usr/local/lib/python3.10/site-packages/httpcore/_async/connection_pool.py", line 253, in handle_async_request
    raise exc
  File "/usr/local/lib/python3.10/site-packages/httpcore/_async/connection_pool.py", line 237, in handle_async_request
    response = await connection.handle_async_request(request)
  File "/usr/local/lib/python3.10/site-packages/httpcore/_async/connection.py", line 90, in handle_async_request
    return await self._connection.handle_async_request(request)
  File "/usr/local/lib/python3.10/site-packages/httpcore/_async/http2.py", line 144, in handle_async_request
    raise exc
  File "/usr/local/lib/python3.10/site-packages/httpcore/_async/http2.py", line 106, in handle_async_request
    await self._send_request_headers(request=request, stream_id=stream_id)
  File "/usr/local/lib/python3.10/site-packages/httpcore/_async/http2.py", line 205, in _send_request_headers
    await self._write_outgoing_data(request)
  File "/usr/local/lib/python3.10/site-packages/httpcore/_async/http2.py", line 370, in _write_outgoing_data
    raise exc
  File "/usr/local/lib/python3.10/site-packages/httpcore/_async/http2.py", line 358, in _write_outgoing_data
    await self._network_stream.write(data_to_send, timeout)
  File "/usr/local/lib/python3.10/site-packages/httpcore/backends/asyncio.py", line 49, in write
    with map_exceptions(exc_map):
  File "/usr/local/lib/python3.10/contextlib.py", line 153, in __exit__
    self.gen.throw(typ, value, traceback)
  File "/usr/local/lib/python3.10/site-packages/httpcore/_exceptions.py", line 14, in map_exceptions
    raise to_exc(exc)
httpcore.WriteError

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

httpx.WriteError

@zanieb zanieb requested a review from a team as a code owner January 11, 2023 18:33
@zanieb zanieb added the enhancement An improvement of an existing feature label Jan 11, 2023
@netlify
Copy link

netlify bot commented Jan 11, 2023

Deploy Preview for prefect-orion ready!

Name Link
🔨 Latest commit 16ae531
🔍 Latest deploy log https://app.netlify.com/sites/prefect-orion/deploys/63bf01dc4c4a8f000922363e
😎 Deploy Preview https://deploy-preview-8145--prefect-orion.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@zanieb zanieb merged commit d8817d5 into main Jan 12, 2023
@zanieb zanieb deleted the write-error-retry branch January 12, 2023 18:44
zanieb added a commit that referenced this pull request Jan 12, 2023
ddelange added a commit to ddelange/prefect that referenced this pull request Jan 18, 2023
…er-builds-consolidation

* 'main' of https://github.com/prefecthq/prefect: (34 commits)
  Minor API docstring formatting fixes, mostly lists (PrefectHQ#8196)
  Build multi-arch images for releases (PrefectHQ#7901)
  feat: Adds "head" flag to `flow-run logs` (PrefectHQ#8003)
  Updates to Automations and Notifications documentation (PrefectHQ#8140)
  Bump @prefecthq/vue-compositions from 1.2.3 to 1.2.9 in /orion-ui (PrefectHQ#8175)
  Bump eslint from 8.31.0 to 8.32.0 in /orion-ui (PrefectHQ#8174)
  Update Postgres tests to use Docker instead of GHA services (PrefectHQ#8125)
  Update `black` and `isort` versions in pre-commit (PrefectHQ#8167)
  Chore: Bump orion and prefect design to 1.2.0 (PrefectHQ#8163)
  Mark `test_process_streams_stderr` as flaky on Python 3.11 (PrefectHQ#8161)
  Add release notes for 2.7.8 (PrefectHQ#8160)
  Add some host_config arguments to DockerContainer (PrefectHQ#8033)
  Skip flaky test `test_dependent_events_in_two_loops_do_not_deadlock` (PrefectHQ#8159)
  Update jsonschema requirement from <4.0.0,>=3.2.0 to >=3.2.0,<5.0.0 (PrefectHQ#8152)
  Fix detection of conda installation in test (PrefectHQ#8149)
  Add `httpx.WriteError` to client retryable exceptions (PrefectHQ#8145)
  Add documentation for cache refreshes (PrefectHQ#8156)
  Add YouTube video to welcome page (PrefectHQ#8090)
  Add social links (PrefectHQ#8088)
  bump orion-design, release flow run timeline (PrefectHQ#8153)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An improvement of an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants