apple / swift-nio-http2

HTTP/2 support for SwiftNIO
https://swiftpackageindex.com/apple/swift-nio-http2/main/documentation/niohttp2
Apache License 2.0
462 stars 82 forks source link

Stream Closed #460

Closed jugu1991 closed 1 week ago

jugu1991 commented 1 week ago

hi, i use Vapor for a network request, but always receive error:

 StreamClosed(streamID: HTTP2StreamID(20003), errorCode: HTTP2ErrorCode<0x8 Cancel>, location: "NIOHTTP2/HTTP2StreamChannel.swift:881"),desc: The operation could not be completed. (NIOHTTP2.NIOHTTP2Errors.StreamClosed error 1.),

HTTPClientError.cancelled,desc: The operation could not be completed. (AsyncHTTPClient.HTTPClientError error 1.)
Lukasa commented 1 week ago

The stream has likely been closed from the network side. This can be a GOAWAY frame, or a number of other possible HTTP/2 frames. Do you have a reproducer scenario for this?

jugu1991 commented 1 week ago

The stream has likely been closed from the network side. This can be a GOAWAY frame, or a number of other possible HTTP/2 frames. Do you have a reproducer scenario for this?

@Lukasa

request url: https://fapi.binance.com/fapi/v1/continuousKlines?interval=15m&contractType=PERPETUAL&pair=WLDUSDT&limit=96

This is not a guaranteed occurrence, but I've encountered it in a Vapor project. In my project, it's possible that multiple concurrent requests are sent to this URL, and so far, it may happen several times a day.

Lukasa commented 1 week ago

Ah, frequently this is an artifact of loadbalancers like nginx, which set a cap on the maximum number of streams they will allow before they terminate the connection. Try using the configuration setting maximumUsesPerConnection and setting it to below 10,000 and see if the issue goes away.

jugu1991 commented 1 week ago

Ah, frequently this is an artifact of loadbalancers like nginx, which set a cap on the maximum number of streams they will allow before they terminate the connection. Try using the configuration setting maximumUsesPerConnection and setting it to below 10,000 and see if the issue goes away.

@Lukasa After following your setting of maximumUsesPerConnection=10000, no errors are reported so far. It seems to be resolved. Thank you.