LuciferYang opened a new pull request, #13913:
URL: https://github.com/apache/gravitino/pull/13913

   ### What changes were proposed in this pull request?
   
   `JettyServer` wraps its handlers in a Jetty `StatisticsHandler`. When the 
server stops, Jetty now waits up to `stopTimeout` for in-flight requests before 
it closes their connections, and requests that arrive on a kept-alive 
connection during that wait get 503. This covers the Gravitino server, the 
Iceberg REST server and the Lance REST server.
   
   ### Why are the changes needed?
   
   Without a graceful handler, stopping the server closed the connections of 
in-flight requests at once, although the requests kept running and Jetty waited 
for them anyway. Clients lost the result of operations that completed, for 
example a create that a retry then rejects with 409.
   
   Fix: #13912
   
   ### Does this PR introduce _any_ user-facing change?
   
   Stopping a server now waits up to `stopTimeout` (30 s by default) for 
in-flight requests to finish. Requests still running after that are cut off as 
before.
   
   ### How was this patch tested?
   
   - `TestJettyServer.testStopLetsInFlightRequestFinish`: stops the server 
while a servlet is blocked, then releases the servlet, and expects the client 
to get its response.
   - Manual check with a locally built Iceberg REST server and a REST backend 
whose create takes 8 s, stopped 2 s into the request: before, the client got an 
empty reply at once and the JVM exited 6.1 s after SIGTERM; after, the client 
got 200 at 6.0 s and the JVM exited at 6.05 s.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to