Skip to content

anyio.EndOfStream can leak up #808

Description

@mcclurem

Originally raised on httpx, referred here

Discussed in encode/httpx#2848

When using httpx as follows:

asyncwithhttpx.AsyncClient(verify=client.verify_ssl) as_client:
response=await_client.request(**kwargs)

with a misbehaving server I will occasionally get an anyio.EndOfStream exception thrown from deep in the call stack.
I would expect that this should have been caught by httpx and converted into one of the applicable httpx exceptions (probably one of the StreamErrors)

call stack that I see this in:

File"/lib/python3.10/site-packages/httpx/_client.py", line1530, inrequestreturnawaitself.send(request, auth-auth, follow_redirects-follow_redirects)
File"/lib/python3.10/site-packages/httpx/_client.py", line1617, insendresponse=awaitself._send_handling_authFile"/lib/python3.10/site-packages/httpx/_client.py", line1645, in_send_handling_authresponse=awaitself._send_handling_redirectsFile"/Users/rack-user/minion_venv/1ib/python3.10/site-packages/httpx/_client.py", line1682, in_send_handling_redirectsresponse=awaitself._send_single_request (request)
File"/lib/python3.10/site-packages/httpx/_client.py", line1719, in_send_single_requestresponse=awaittransport. handle_async_request(request)
File"/Users/rack-user/minion_venv/lib/python3.10/site-packages/httpx/_transports/default.py", line353, inhandle_async_requestresp=awaitself._pool.handle_async_request(reg)
File"/lib/python3.10/site-packages/httpcore/_async/connection_pool.py", line262, inhandle_async_requestraiseexcFile"/lib/python3.10/site-packages/httpcore/_async/connection_pool.py", line245, inhandle_async_requestresponse=awaitconnection.handle_async_request(request)
File"/lib/python3.10/site-packages/httpcore/_async/connection.py", line92, inhandle_async_requestraiseexcFile"/lib/python3.10/site-packages/httpcore/_async/connection.py", line69, inhandle_async_requeststream=awaitself._connect(request)
File"/lib/python3.10/site-packages/httpcore/_async/connection.py", line149, in_connectstream=awaitstream.start_tls(**kwargs)
File"/Users/rack_user/minion-venv/lib/python3.10/site-packages/httpcore/_backends/anyio.py", line78, instart_tlsraiseexcFile"/lib/python3.10/site-packages/httpcore/_backends/anyio.py", line69, instart_tlsssl_stream=awaitanyio.streams.tls.TLSStream.wrap(
File"/lib/python3.10/site-packages/anyio/streams/tls.py", line125, inwrapawaitwrapper._call_sslobject_method(ss1_object.do_handshake)
File"/lib/python3.10/site-packages/anyio/streams/tls.py", line165, in_call_sslobject_methodraiseEndOfStreamfromNone

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions