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

Raise ConnectionNotAvailable instead of RemoteProtocolError on request with terminated HTTP/2 connections #683

Closed
wants to merge 1 commit into from

Conversation

zanieb
Copy link
Contributor

@zanieb zanieb commented May 11, 2023

Follow-up to #679 (comment)

Attempts to improve handling of HTTP/2 behavior when connections are terminated.

Refs #730

tests/_async/test_http2.py Outdated Show resolved Hide resolved
@zanieb zanieb requested a review from tomchristie May 11, 2023 21:25
@zanieb zanieb marked this pull request as draft May 11, 2023 21:25
Base automatically changed from h2-closed to master May 12, 2023 12:54
@tomchristie
Copy link
Member

If I was going to tackle this I would probably start with just the failing test case(s).

  • Changing the behaviour of the existing test, ensuring that ConnectionNotAvailable is raised instead of RemoteProtocolError.
  • Adding a test at the connection pool level - sending 2 requests with a mock connection that always sends GoAway after the first response, and ensuring that both requests succeed. (Because the second gracefully retries)

Comment on lines +148 to +153
if isinstance(
self._connection_error_event, h2.events.ConnectionTerminated
):
raise ConnectionNotAvailable(self._connection_error_event)
else:
raise RemoteProtocolError(self._connection_error_event)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't love this repeated isinstance check. We could move it into a utility or just always treat _connection_error_event as ConnectionNotAvailable instead of a protocol error.

@zanieb
Copy link
Contributor Author

zanieb commented May 12, 2023

Failing coverage checks now. I didn't add a test at the connection pool level yet. There are not HTTP/2 examples there, but it doesn't seem hard to add a mock stream as you suggested. Feel free to push changes.

@tomchristie tomchristie added the bug Something isn't working label Jun 14, 2023
@tomchristie
Copy link
Member

I've added issue #730 so that we're tracking this neatly.

@tomchristie
Copy link
Member

Thanks! Now superseeded by #733

@tomchristie tomchristie deleted the h2-closed-retry branch June 16, 2023 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants