HTTP: Handle HTTP/2 GOAWAY premature close
See original GitHub issueThe problem can be reproduced with a standard nginx version, with ssl and http/2 activated, as by default, nginx recycles http2 connection every 1000 requests
I’ve just modified the standard nginx config ( from ubuntu standard package) with http2 and ssl config:
server {
listen 443 ssl http2 default_server;
include snippets/snakeoil.conf;
root /var/www/html;
server_name localhost;
}
class BasicSimulation extends Simulation {
val httpProtocol = http
.baseUrl("https://localhost") // Here is the root for all relative URLs
.acceptHeader("text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8") // Here are the common headers
.doNotTrackHeader("1")
.acceptLanguageHeader("en-US,en;q=0.5")
.acceptEncodingHeader("gzip, deflate")
.userAgentHeader("Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:16.0) Gecko/20100101 Firefox/16.0")
.enableHttp2
.disableCaching // caching disabled to reproduce the problem with static resources
val scn = scenario("Scenario Name") // A scenario is a chain of requests and pauses
.forever(
exec(http("request_1")
.get("/"))
.pause(10 milliseconds)
.exitHereIfFailed
)
setUp(scn.inject(constantConcurrentUsers(1) during (5 minutes)).protocols(httpProtocol))
}
The reproduction of the problem depends on the pause duration, the latency between client and server and probably the load of the different systems:
- with a remote system and a slow network, the problem can occurs sometimes with 100ms pause
- with a local/fast server, I had to reduce the pause to 10 ms
- On my real test, I use pace, so when the system starts to slow, I believe the pause time is reduced a lot and explain why the problem occurs
when the error occurs, the following messages can be seen:
---- Errors --------------------------------------------------------------------
i.n.h.c.h.Http2Exception$StreamException: Cannot create stream 1 (100,0%)
2003 greater than Last-Stream-ID 2001 from GOAWAY.
and then:
i.g.h.c.i.RequestTimeoutException: Request timeout to localhos 1 (20,00%)
t/127.0.0.1:443 after 60000 ms
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:9 (6 by maintainers)
Top Results From Across the Web
How to handle HTTP/2 GOAWAY with HttpClient?
A server is entitled to close connections at any time, for any reason. In the HTTP/2 GOAWAY frame there is the indication of...
Read more >HTTP/2 | Node.js v19.3.0 Documentation
Once closed, http2session.destroy() might be called if there are no open Http2Stream instances. If specified, the callback function is registered as a handler...
Read more >Update to gRPC logs GOAWAY with error code ... - GitLab
Why am I receiving a GOAWAY with error code ENHANCE_YOUR_CALM? ... but notice how the connection was closed prematurely:.
Read more >HTTP/2 and How it Works - Carson - Medium
The stream-0 is reserved for flow-control. It cannot be closed. It is possible to prioritize streams. A server can respond with requests for...
Read more >RFC 9113: HTTP/2 - IETF HTTP Working Group
Clients and servers MUST treat an invalid connection preface as a connection error (Section 5.4.1) of type PROTOCOL_ERROR. A GOAWAY frame (Section 6.8)...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi,
I am also facing the same error for aforesaid code, could you please help?
Yeah, but then it will remain the same forever if no one else gives it a try 🤷