-
Notifications
You must be signed in to change notification settings - Fork 633
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
Server closes the connection with a FIN packet immediately after sending a GO_AWAY frame. All accepted streams upto the lastStreamId are not getting processed #2735
Comments
@Sumi264 Can you describe your scenario in more details? Is this a graceful shutdown of the server or some other connection close scenario? |
@violetagg Yes, graceful shutdown is configured for the application server. The application is running in a containerized environment in a kubenetes pod. I'm deleting the pod to observe the behaviour of server in graceful shutdown scenario.
|
@violetagg I'm pasting the logs snippet where it's visible that GO_AWAY frame has lastStreamId=2127, and INBOUND DATA is seen for this streamId, but no OUTBOUND DATA. The connection gets closed as soon as the graceful shutdown is triggered with GO_AWAY frame, without processing this lastStream.
|
Hi @violetagg , I was going through the fix that was provided for this issue, and came across some comments saying '//"FutureReturnValueIgnored" this is deliberate'. I want to give a brief description of my application server (built on reactive netty using spring-webflux), which exposes a rest api with the below signature.
This API is responsible for receiving the requests and handing them over to an executor thread pool, which does some processing. In the cases where CompletableFuture is used in the RestController, will the fix provided work? |
@Sumi264 Please either provide some reproducible example or at least some logs where |
@violetagg Please find the logs with wiretap enabled. Here, |
I added one additional log so that you can check when the server is about to stop and then you can check when GO_AWAY happens #2742 |
@violetagg Sure, let me try it out, and share the logs with you. Thanks!! |
Hi @violetagg, I've captured the logs. Here, for streamId=3767 no outbound data is there, and the connection is closed after goaway packet. Please let me know if any more info is needed. Thanks!! |
@Sumi264 Any chance for a reproducible example? |
@violetagg I'll try to share a reproducible example soon. |
@violetagg In my sample application, each request processing takes 200ms. From the captured logs it is observed that after receiving graceful shutdown signal, the server waits for some amount of time (~190ms) and processes OUTBOUND response for some of the accepted streams, and then it sends GO_AWAY and terminates the server, even though there are unprocessed streams with streamId less than or equal to lastStreamId quoted in GO_AWAY frame.
I was looking into the fix made in disposeNow(Duration timeout) api. RFC https://www.rfc-editor.org/rfc/rfc7540#section-6.8 states that all "Activity on streams numbered lower or equal to the last stream identifier might still complete successfully. The sender of a GOAWAY frame might gracefully shut down a connection by sending a GOAWAY frame, maintaining the connection in an "open" state until all in-progress streams complete." On receiving a signal for graceful shutdown, the server should have sent a GO_AWAY, and waited till the time lastStream accounted in GO_AWAY gets processed. But here, in logs it seems after receiving a graceful shutdown signal at "2023-03-30 10:35:35.579", server processes requests till streamId 1557 till "2023-03-30 10:35:35.768". nettytest.zip
|
Sure, let me try it out @violetagg. Thanks!! |
Hi @violetagg , Thanks!! |
That's very good. Thanks!
The timeout that is used for |
Hi @violetagg I'm running this application in a k8s pod, built with springboot(as shown in the earlier attached reproducible example). It would be nice to have any api like above where user can pass the graceful termination period in seconds. |
@Sumi264 For questions related to Spring you should contact Spring maintainers. Quick search shows that there is such configuration already https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#web.graceful-shutdown |
@violetagg I'm using "spring.lifecycle.timeout-per-shutdown-phase=20s" already in my application, does it mean, disposeNow(timeout) api will consider timeout as 20s? |
I don't know the integration in Spring Boot. |
Hi @violetagg While testing the above fix with high traffic I observed some connections are closing without a GoAway. Test 1: 20 Connections and 200 MPS Traffic Test 2: 100 Connections and 1000 MPS Traffic with 150ms delay in my application built with reactive netty (with spring webflux). |
Hi @Sumi264 , I don't see any CLOSE in the log files. Regarding the RST or FIN, is it sent by the client or by the server ? Can you tell how to reproduce this ? is it with your reproducer nettyyest ? should I run a load using the "netty/test/goaway" URI or using "netty/streams" ? thanks |
Hi @pderop,
For reproducing this issue, NettyServer-sample-app can be used, and load can be run on "netty/streams" API. Please let me know if any further info is needed. |
thanks a lot @Sumi264; FYI, I'm investigating since yesterday, will try to get back to you soon. |
I have reproduced, thanks @Sumi264; We might have a problem when the server is configured with H2C, and HTTP1.1 |
Sure @pderop, let me try it out. Thanks !! |
Hi @pderop, Tried testing it with 2 MPS and 4 MPS traffic. It seems to be working fine now. |
Hi @violetagg and @pderop, Thanks in advance! |
@Sumi264 The release is planned for tomorrow. |
@move02 The mentioned PR is related to HTTP/2 only. |
Sorry for deleting my comment. The comment was this PR also related when HTTP11 server also and it wasn't. Thanks for replying. |
My application server using http2 reactive netty server (version: 1.0.26) closes the connection immediately after sending a GO_AWAY packet, without processing outstanding requests up to the lastStreamId.
+--- org.springframework.boot:spring-boot-starter-webflux:2.7.7
| +--- org.springframework.boot:spring-boot-starter:2.7.7 ()
| +--- org.springframework.boot:spring-boot-starter-json:2.7.7 ()
| +--- org.springframework.boot:spring-boot-starter-reactor-netty:2.7.7
| | --- io.projectreactor.netty:reactor-netty-http:1.0.26
https://www.rfc-editor.org/rfc/rfc7540#section-6.8 states that all "Activity on streams numbered lower or equal to the last stream identifier might still complete successfully. The sender of a GOAWAY frame might gracefully shut down a connection by sending a GOAWAY frame, maintaining the connection in an "open" state until all in-progress streams complete."
Does reactive netty server support processing of all accepted streams upto the lastStreamId sent in GO_AWAY frame before terminating the connection? If yes, then please advise if some configuration is needed to make reactive netty http2 server to ensure the processing of all streams up to the lastStreamId quoted in GO_AWAY frame.
The text was updated successfully, but these errors were encountered: