You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Http and tls services are not initialized and terminated correctly #13720
When the queue is asked to exit, drainer.Drain() is used to wait for 30s, after the 30s:
metrix is asked to Shutdown() (and exists)
admin is asked to Shutdown() (and exists)
queue completes termination and flush
Note that main never asked to Shutdown() and never exists!! does this mean there may still be connections being served?
Note also that Shutdown is performed without timeout and can wait indefinitely.
With TLS, 2 http servers are created:
main
metrics
And 2 tls servers are created:
tlsMain
tlsAdmin
The main have a drainer.
The tlsMain have a second, unrelated drainer that is never being used. Lets call it drainerTls.
When the queue is asked to exit, drainer.Drain() is used to wait for 30s, after the 30s:
metrix is asked to Shutdown() (and exists)
queue completes termination and flush
Note that drainerTls.Drain() was never called, the tlsMain and the tlsAdmin were never Shutdown and never exited before queue exists, Also, as before, main never Shutdown() and never exit as well.
Again, note also that Shutdown is performed without timeout and can wait indefinitely.
The code comment indicates:
// Removing the main server from the shutdown logic as we've already shut it down.
delete(httpServers, "main")
But it is unclear where is it being shutdown.
The code comment also:
// TODO: The drain created with mainServer above is lost. Unify the two drain.
Which is inline with my reading
The code comment also:
// Drop admin http server as we Use TLS for the admin server.
...
// delete(httpServers, "admin")
Why do we not also drop the admin, while we use tlsAdmin?
I have confirmed that main continues to serve open connections after flush()
I have confirmed that main continues to accept new connections after flush()
i have been running into an issue with v1.9
that when a pod was marked for deletion any active requests would be dropped (after the 30s wait), even if the timeoutSeconds was set to 600.
the shutdown logs i would see were
Attached drain handler from user-container&{GET /wait-for-drain HTTP/1.1 1 1 map[Accept-Encoding:[gzip] Referer:[http://10.122.14.239:8022//wait-for-drain] User-Agent:[Go-http-client/1.1]] {} <nil> 0 [] false 10.122.14.239:8022 map[] map[] <nil> map[] 10.122.14.1:54218 /wait-for-drain <nil> <nil> <nil> 0xc00001aac0}
Received TERM signal, attempting to gracefully shutdown servers.
Shutting down server: metrics
Shutting down server: admin
Shutdown complete, exiting...
now the Shutdown complete would show up while my long running request was still in progress, and right after the queue-proxy container shut down, is when i would receive an error response (sometimes EOF sometimes dial tcp <pod-ip>:8012: connect: connection refused) this is also if i made sure my user container is not handling SIGTERM's and not shutting down.
after testing the nightly build (gcr.io/knative-nightly/knative.dev/serving/cmd/queue@sha256:454d02ee2d84965e44068b4c658e80299af98159e0fc362888c3303cfd8631f4) this was fixed. my theory is that the main server was never Shutdown (which does wait for in flight reqs) and the drainer does not seem to handle this either, which means any requests still running after the 30s wait will error out.
this was fixed in #13815
note that i did not test this on a clean install and dont have a clear repro script, but if my assumptions are right, repro'ing this is just a matter of calling a long running endpoint and killing the pod that got that request.
thanks @dprotaso for jumping on so quickly to help out!
Activity
davidhadas commentedon Feb 20, 2023
/assign @davidhadas
davidhadas commentedon Feb 20, 2023
(removed)
davidhadas commentedon Feb 20, 2023
I have confirmed that
maincontinues to serve open connections after flush()I have confirmed that
maincontinues to accept new connections after flush()[-]Drainer seem to not work correctly[/-][+]Http and tls services are not initialized and terminated correctly [/+]dprotaso commentedon Mar 29, 2023
Closing as per #13723 (comment)
dermasmid commentedon Mar 30, 2023
i have been running into an issue with v1.9
that when a pod was marked for deletion any active requests would be dropped (after the 30s wait), even if the
timeoutSecondswas set to 600.the shutdown logs i would see were
now the Shutdown complete would show up while my long running request was still in progress, and right after the queue-proxy container shut down, is when i would receive an error response (sometimes EOF sometimes
dial tcp <pod-ip>:8012: connect: connection refused) this is also if i made sure my user container is not handling SIGTERM's and not shutting down.after testing the nightly build (
gcr.io/knative-nightly/knative.dev/serving/cmd/queue@sha256:454d02ee2d84965e44068b4c658e80299af98159e0fc362888c3303cfd8631f4) this was fixed. my theory is that themainserver was neverShutdown(which does wait for in flight reqs) and the drainer does not seem to handle this either, which means any requests still running after the 30s wait will error out.this was fixed in #13815
note that i did not test this on a clean install and dont have a clear repro script, but if my assumptions are right, repro'ing this is just a matter of calling a long running endpoint and killing the pod that got that request.
thanks @dprotaso for jumping on so quickly to help out!