Skip to content

KAFKA-21093: Ensure all ConfigProviders get closed before throwing exception - #23516

Open
lucliu1108 wants to merge 2 commits into
apache:trunkfrom
lucliu1108:KAFKA-21093
Open

lucliu1108 wants to merge 2 commits into
apache:trunkfrom
lucliu1108:KAFKA-21093

Conversation

@lucliu1108

@lucliu1108 lucliu1108 commented Sep 18, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • AbstractConfig.instantiateConfigProviders: close already-created
    providers before rethrowing on ClassNotFoundException; also close the
    in-flight provider on any RuntimeException from configure(), since
    it wasn't added to the map yet.
  • AbstractConfig.resolveConfigVariables: move the provider close call
    into a finally so it still runs if ConfigTransformer.transform()
    throws.
  • Worker.initConfigTransformer / MirrorMakerConfig.transform: same
    fix as above for the provider-instantiation loops in Connect.
  • Plugins.newConverter / newInternalConverter /
    newHeaderConverter: close the plugin if configure() throws; also 2
    same leaks, on Converter/HeaderConverter.

Reviewers: Chia-Ping Tsai chia7712@gmail.com

if (!result.data().isEmpty()) {
resolvedOriginals.putAll(result.data());
try {
if (!providers.isEmpty()) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we move the try-finally into this if block, so it only runs when providers is non-empty?

@github-actions github-actions Bot removed small Small PRs triage PRs from the community labels Sep 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants