Thanks to visit codestin.com
Credit goes to github.com

Skip to content

HTTP/2: infinite retry with 2 parallel requests on one connection receiving GOAWAY with ENHANCE_YOUR_CALM error code #5119

@selivni

Description

@selivni

I did this

I am sending two parallel requests with huge URLs (about 5k symbols) to a remote Nginx server by one connection, exceeding its http2_max_field_size (4kb by default).

I expected the following

I expect curl to return an error after receiving a GOAWAY from server.

What seems to actually happen

  1. Curl sends two parallel requests to Nginx
  2. Nginx fails to process first request and returns GOAWAY with ENHANCE_YOUR_CALM error code.
  3. Nghttp2 seems to ignore the error code and only calls on_stream_close() with REFUSED_STREAM error code for stream related to the second request (which is partially correct since Nginx didn't try to process it).
  4. After this, curl receives TLS close notify and decides to retry both requests, because the connection they run on is marked as reused.
  5. Since both requests are "bad" for Nginx, curl will keep failing to finish them even if it tries to change the order the requests are processed.

Versions

libcurl 7.65.2
Nginx 1.10.3, 1.12., 1.14.

Logs

libcurl logs (with DEBUG_HTTP2 and CURLOPT_VERBOSE)
https://gist.github.com/selivni/880049e63a23f2fe7a69536c06e62c86

How to reproduce

I reproduced the issue using this piece of c++ code, this Nginx config, and this URL.

If you change NUM_REQUESTS value to 1, everything will work fine and curl will successfully fail the request with "Empty reply from server" error.

Operating system

I've been able to reproduce this on Android and Darwin (Catalina 10.15.3) with Nginx running on Ubuntu 16.04.6.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions