[Enhancement] Request to add "connection: close" response header via http/1.1 connection after graceful shutdown phase started #40802
Labels
for: external-project
For an external project and not something we can fix
status: invalid
An issue that we don't feel is valid
Hello. I have request about
graceful shutdown
onhttp/1.1
connection.I though this request fit in
spring boot
side, but sorry about ifspring boot
is not a role about this behavior.Sorry for this PR might have any confuse words or sentences, too.
While configure
k8s
environment runSpring Boot
Server withApplication Load Balancer
(a.k.aALB
)I heard there are chance to client can get
503
fromALB
.ALB
are communicating with a pod usingHTTP/1.1
in my case.When I
rolling update
pods with new image ink8s
, there are must benewly created pods
andterminating pods
.And in
terminating pods
,Spring Boot
are ingraceful shutdown
phase, sonew connection
to these will gotRST
packet.In additional, after
graceful shutdown
phase, processed requests are not includeconnection
response header.Because of above
ALB
may try to connectSpring Boot
ingraceful shutdown
phase, gotRST
and ALB response to client with503
ALB
may gotresponse
fromSpring Boot
ingraceful shutdown
phase which noconnection
header.So, if next request fired,
ALB
try to reuse current connection because beforeconnection
is recognized askeep-alive
, then gotRST
andALB
response to client with503
This may solved by make
ALB
retry to another instance several times until got success packet notRST
.But this behavior seems not good because
ALB
may gotRST
by another reason.If I use
HTTP/2
, I gotGOAWAY
frame atgraceful shutdown
phase begun from connection by async.And this behavior done by
tomcat
notSpring Boot
.But I can't use
HTTP/2
in my environment now.Seems
Golang
had a issue similar this before, so it looks like have a code that addconnection: close
response header on shutdown phase.https://cs.opensource.google/go/go/+/refs/tags/go1.22.3:src/net/http/server.go;l=1512
https://cs.opensource.google/go/go/+/refs/tags/go1.22.3:src/net/http/server.go;l=1355
https://cs.opensource.google/go/go/+/refs/tags/go1.22.3:src/net/http/server.go;l=1266
https://cs.opensource.google/go/go/+/refs/tags/go1.22.3:src/net/http/server.go;l=3385
This might need to done in
tomcat
or else side.But I thought
graceful shutdown
phase itself is controlled bySpring Boot
viaorg.springframework.boot.web.embedded.tomcat.GracefulShutdown
inorg.springframework.boot:spring-boot
dependency.Am I have to carry this to servers community like tomcat, jetty, netty, undertow?
The text was updated successfully, but these errors were encountered: