Prefork mode state isolation and request-scoped cleanup in Fiber v3
0 reputation · 02 Oct 2025, 07:56 UTC
Goal is to clarify request-scoped storage cleanup and state isolation guarantees for Fiber v3 applications running with Prefork enabled and custom middleware that references App-level state. The configuration transition from single-process to Prefork changes the process model and initialization semantics compared with the default single-process mode.
Fiber v3 reorganizes router and context APIs and enforces stricter context usage relative to v2. Prefork is documented as spawning multiple OS processes behind a listener, which alters how global state, middleware initialization and graceful shutdown are handled. The documentation describes the process model change but does not specify cleanup timing for request-scoped values or isolation guarantees for App-level state accessed by middleware across workers.
What cleanup guarantees does Fiber v3 provide for request-scoped storage when Prefork is enabled? Are App-level values initialized once per worker or shared across workers, and is that isolation documented? How should middleware that uses App-level state be structured to avoid cross-request leakage under Prefork?