ConnectionTerminated error_code:ErrorCodes.NO_ERROR

See original GitHub issue

With httpx using httpcore interface, started receiving the following error:

<ConnectionTerminated error_code:ErrorCodes.NO_ERROR, last_stream_id:1999, additional_data:None>

Don’t know h2 specifics to say, but could NO_ERROR be used for some indication like graceful connection closing rather than raising an error?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
twisteroidambassadorcommented, Mar 7, 2022

I think I have run into the same issue. After issuing many requests on an http2 connection using httpx, all subsequent requests fail immediately with httpx.RemoteProtocolError: <ConnectionTerminated error_code:ErrorCodes.NO_ERROR, last_stream_id:19999, additional_data:None>.

Package versions: h2-4.1.0 httpcore-0.14.7 httpx-0.22.0

Full traceback:

Traceback (most recent call last):
  File "~\venv\lib\site-packages\h2\connection.py", line 224, in process_input
    func, target_state = self._transitions[(self.state, input_)]
KeyError: (<ConnectionState.CLOSED: 3>, <ConnectionInputs.SEND_HEADERS: 0>)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "~\venv\lib\site-packages\httpcore\_async\http2.py", line 105, in handle_async_request
    await self._send_request_headers(request=request, stream_id=stream_id)
  File "~\venv\lib\site-packages\httpcore\_async\http2.py", line 202, in _send_request_headers
    self._h2_state.send_headers(stream_id, headers, end_stream=end_stream)
  File "~\venv\lib\site-packages\h2\connection.py", line 766, in send_headers
    self.state_machine.process_input(ConnectionInputs.SEND_HEADERS)
  File "~\venv\lib\site-packages\h2\connection.py", line 228, in process_input
    raise ProtocolError(
h2.exceptions.ProtocolError: Invalid input ConnectionInputs.SEND_HEADERS in state ConnectionState.CLOSED

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "~\venv\lib\site-packages\httpx\_transports\default.py", line 60, in map_httpcore_exceptions
    yield
  File "~\venv\lib\site-packages\httpx\_transports\default.py", line 353, in handle_async_request
    resp = await self._pool.handle_async_request(req)
  File "~\venv\lib\site-packages\httpcore\_async\connection_pool.py", line 253, in handle_async_request
    raise exc
  File "~\venv\lib\site-packages\httpcore\_async\connection_pool.py", line 237, in handle_async_request
    response = await connection.handle_async_request(request)
  File "~\venv\lib\site-packages\httpcore\_async\connection.py", line 90, in handle_async_request
    return await self._connection.handle_async_request(request)
  File "~\venv\lib\site-packages\httpcore\_async\http2.py", line 138, in handle_async_request
    raise RemoteProtocolError(self._connection_error_event)
httpcore.RemoteProtocolError: <ConnectionTerminated error_code:ErrorCodes.NO_ERROR, last_stream_id:19999, additional_data:None>

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

Traceback (most recent call last):
  File "~\decryptor.py", line 138, in do_decrypt_work
    resp = await client.get(test_v3_url)
  File "~\venv\lib\site-packages\httpx\_client.py", line 1729, in get
    return await self.request(
  File "~\venv\lib\site-packages\httpx\_client.py", line 1506, in request
    return await self.send(request, auth=auth, follow_redirects=follow_redirects)
  File "~\venv\lib\site-packages\httpx\_client.py", line 1593, in send
    response = await self._send_handling_auth(
  File "~\venv\lib\site-packages\httpx\_client.py", line 1621, in _send_handling_auth
    response = await self._send_handling_redirects(
  File "~\venv\lib\site-packages\httpx\_client.py", line 1658, in _send_handling_redirects
    response = await self._send_single_request(request)
  File "~\venv\lib\site-packages\httpx\_client.py", line 1695, in _send_single_request
    response = await transport.handle_async_request(request)
  File "~\venv\lib\site-packages\httpx\_transports\default.py", line 352, in handle_async_request
    with map_httpcore_exceptions():
  File "AppData\Local\Programs\Python\Python310\lib\contextlib.py", line 153, in __exit__
    self.gen.throw(typ, value, traceback)
  File "~\venv\lib\site-packages\httpx\_transports\default.py", line 77, in map_httpcore_exceptions
    raise mapped_exc(message) from exc
httpx.RemoteProtocolError: <ConnectionTerminated error_code:ErrorCodes.NO_ERROR, last_stream_id:19999, additional_data:None>
1reaction
twisteroidambassadorcommented, Mar 15, 2022

I have created a discussion topic for this problem over at httpx’s repository: https://github.com/encode/httpx/discussions/2112

Perhaps we can get more attention over there.

Read more comments on GitHub >

github_iconTop Results From Across the Web

1 Troubleshooting PDF Free Download - DocPlayer.net
1 Troubleshooting This chapter describes solutions for problems you may encounter while using the GP3000 series. Read the section describing the problem you ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found