Skip to content

Commit ca35c22

Browse files
committed
fix: initialize AWS provider in sync mode for MSK IAM
- Switch provider to sync mode before initialization to prevent hanging - Initialize provider with sync mode (required before event loop is available) - Switch back to async mode after successful initialization - Follows pattern used by other AWS credential providers This fixes potential credential initialization failures in IRSA/EKS deployments where HTTP requests during init would hang without the event loop. Signed-off-by: Arbin <[email protected]>
1 parent 1f9b74a commit ca35c22

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/aws/flb_aws_msk_iam.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -779,7 +779,8 @@ struct flb_aws_msk_iam *flb_aws_msk_iam_register_oauth_cb(struct flb_config *con
779779
return NULL;
780780
}
781781

782-
/* Initialize provider */
782+
/* Initialize provider in sync mode (required before event loop is available) */
783+
ctx->provider->provider_vtable->sync(ctx->provider);
783784
if (ctx->provider->provider_vtable->init(ctx->provider) != 0) {
784785
flb_error("[aws_msk_iam] failed to initialize AWS credentials provider");
785786
flb_aws_provider_destroy(ctx->provider);
@@ -789,6 +790,8 @@ struct flb_aws_msk_iam *flb_aws_msk_iam_register_oauth_cb(struct flb_config *con
789790
flb_free(ctx);
790791
return NULL;
791792
}
793+
/* Switch back to async mode */
794+
ctx->provider->provider_vtable->async(ctx->provider);
792795

793796
flb_info("[aws_msk_iam] AWS credentials provider created and initialized successfully");
794797

0 commit comments

Comments
 (0)