Skip to content

Retry HTTP/2 REFUSED_STREAM errors automatically #6700

@swankjesse

Description

@swankjesse

The specs suggest it's safe to do so

  • The REFUSED_STREAM error code can be included in a RST_STREAM frame to indicate that the stream is being closed prior to any processing having occurred. Any request that was sent on the reset stream can be safely retried.

https://httpwg.org/specs/rfc7540.html#Reliability

Nginx can be configured to send this on old-enough connections:

Sets the maximum number of requests that can be served through one keep-alive connection. After the maximum number of requests are made, the connection is closed.

Closing connections periodically is necessary to free per-connection memory allocations. Therefore, using too high maximum number of requests could result in excessive memory usage and not recommended.

http://nginx.org/en/docs/http/ngx_http_core_module.html#keepalive_requests

And our users are otherwise going to do it manually.

Is there an option (we may have missed) so OkHttp takes care of this transparently to the application?

https://stackoverflow.com/questions/67883227/dealing-with-okhttp-http-2-refused-stream-errors

We need a limit on how many automatic retries to attempt; maybe 1. Such retries should be on a different connection.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugBug in existing codeenhancementFeature not a bug

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions