fix(audit): move audit init after IAM bootstrap to fix startup ordering (#5685)

Audit initialization requires the AppContext (server config + object
store) which is published by ensure_startup_after_iam inside
init_iam_runtime. Moving init_audit_runtime after init_iam_runtime
ensures the runtime sources are available when audit starts.

Fixes #5681

Co-authored-by: RustFS <hello@rustfs.com>
This commit is contained in:
Zhengchao An
2026-08-04 11:45:48 +08:00
committed by GitHub
parent 48c8d85f3b
commit e08cf474db
+4 -1
View File
@@ -75,11 +75,14 @@ pub(crate) async fn init_startup_runtime_services(
let optional_runtimes = init_optional_runtime_services().await?;
init_buffer_profile_system(config);
init_audit_runtime().await;
init_deadlock_detector_runtime();
let buckets = init_bucket_metadata_runtime(store.clone(), ctx.clone()).await?;
let iam_bootstrap = init_iam_runtime(store.clone(), ctx.clone(), readiness, state_manager, server_ctx).await?;
// Audit initialization requires the AppContext (server config + object store)
// which is published by ensure_startup_after_iam inside init_iam_runtime.
init_audit_runtime().await;
// Unconditional: deferred IAM recovers in the background and has no callback into this
// scheduler, so gating on the inline disposition would leave a recovered node with
// self-pointing replication rules until the next restart. The task waits for IAM and