tusd
tusd copied to clipboard
Gracefully terminate on SIGTERM
Is your feature request related to a problem? Please describe. We are currently running tusd in Kubernetes. During normal operation (upgrades, autoscaling, etc), Kubernetes shuts down tusd, first by sending a SIGTERM, waiting for a grace period, then sending a SIGKILL. We ran into issues because tusd uses the default behavior for Go programs, which is to immediately ungracefully terminate upon receiving a SIGTERM. Occasionally this causes files to become locked, and tusd returns consistent 423 responses until the upload is restarted (we are using the python client in this case).
Describe the solution you'd like It would be great if tusd could gracefully shutdown upon receiving a SIGTERM, ie flush out any pending requests then close.
Describe alternatives you've considered We have a fork of tusd at https://github.com/cvisionai/tusd in which SIGTERM is simply ignored. This resolves our issue, but the correct behavior is to gracefully terminate.
Can you provide help with implementing this feature? Yes we can if this is a desired feature in tusd.
You are absolutely right, tusd should be able to gracefully shut down. We would be very happy to assist you with a PR!
Hi,
I have a very rough cut of a fix for this issue here: https://github.com/rbastic/tusd/commit/90a8d992ca6701a0bea0a1d81acdaa5b02f3f1e0
Would you care to "pre-review" this and give me your feedback? It still needs more extensive testing. I am likely missing something, am still getting my head wrapped around the codebase.
Thanks! Ryan
+1
@rbastic Would you mind opening a PR with your change? Then we can talk about your commit and provide easy advice when needed :)
I'm interested in this as well -- is there any update?
@geor-g There are unfortunately no updates on this.
#963 has been merged, so this will be included in the upcoming v2 release!