* fix: wait for in-flight uploads to complete before filer shutdown
Prevents data corruption when SIGTERM is received during active uploads.
The filer now waits for all in-flight operations to complete before
calling the underlying shutdown logic.
This affects all deployment types (Kubernetes, Docker, systemd) and
fixes corruption issues during rolling updates, certificate rotation,
and manual restarts.
Changes:
- Add FilerServer.Shutdown() method with upload wait logic
- Update grace.OnInterrupt hook to use new shutdown method
Fixes data corruption reported by production users during pod restarts.
* fix: implement graceful shutdown for gRPC and HTTP servers, ensuring in-flight uploads complete
* fix: address review comments on graceful shutdown
- Add 10s timeout to gRPC GracefulStop to prevent indefinite blocking
from long-lived streams (falls back to Stop on timeout)
- Reduce HTTP/HTTPS shutdown timeout from 25s to 15s to fit within
Kubernetes default 30s termination grace period
- Move fs.Shutdown() (database close) after Serve() returns instead
of a separate hook to eliminate race where main goroutine exits
before the shutdown hook runs
* fix: shut down all HTTP servers before filer database close
Address remaining review comments:
- Shut down auxiliary HTTP servers (Unix socket, local listener) during
graceful shutdown so they can't serve write traffic after the main
server stops
- Register fs.Shutdown() as a grace.OnInterrupt hook to guarantee it
completes before os.Exit(0), fixing the race between the grace
goroutine and the main goroutine
- Use sync.Once to ensure fs.Shutdown() runs exactly once regardless
of whether shutdown is signal-driven or context-driven (MiniCluster)
---------
Co-authored-by: Chris Lu <chris.lu@gmail.com>