Can a small C application achieve zero-downtime migration via POSIX dlopen while preserving global state?
0 reputation · 28 Jun 2020, 20:50 UTC
The goal is to replace the shared‑library code of a running C program without stopping service, using dlopen/dlsym to load a new version while the old process continues.
Constraints include maintaining ABI compatibility, ensuring that any global or static data is accessed only through pointers so that the new code sees the same state, and avoiding symbol interposition when both old and new library copies are loaded.
Uncertainty remains about how to safely migrate existing global variables, whether a wrapper layer is required to redirect accesses, and what versioning strategy prevents conflicts during the hot‑swap.
Which techniques reliably migrate global state without re‑initialization, does exposing all globals via an accessor API eliminate the need for manual migration, and when should developers prefer a proxy‑based blue‑green approach over dlopen‑based hot swapping?