mirror of
https://github.com/floci-io/floci.git
synced 2026-11-24 06:20:24 -05:00
fix(storage): flush persisted state before container teardown on shutdown (#1607)
onStop() flushed storage last, after the slow proxy/container teardown, so a graceful shutdown could be cut off by the SIGTERM grace window before buffered hybrid data was written (e.g. ECS clusters lost across a restart). Flush first; keep shutdownAll() at the end. Adds an EmulatorLifecycle ordering-guard test. Refs #1521.
This commit is contained in:
1 parent
47e79b0ff5
commit
5eec726902
2 files changed
+22
No files matched your search
@@ -233,6 +233,12 @@ public class EmulatorLifecycle {
|
||||
}
|
||||
|
||||
void onStop(@Observes ShutdownEvent ignored) {
|
||||
// Flush persisted state to disk FIRST, before the slow proxy/container teardown below.
|
||||
// Stopping Docker sidecars (RDS/ElastiCache/etc.) can block long enough to exhaust the
|
||||
// SIGTERM grace window and trigger SIGKILL; if the flush ran last it would be skipped and
|
||||
// in-memory (hybrid) data would be lost on an otherwise-graceful shutdown. shutdownAll()
|
||||
// still runs at the end to stop the flush schedulers and capture any shutdown-time writes.
|
||||
storageFactory.flushAll();
|
||||
if (config.services().ec2().enabled() && !config.services().ec2().mock()) {
|
||||
ec2MetadataServer.stop();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user