Skip to content

Potential race condition in PluginTenantConfigurableConfigurationHandler #100

@steven-barnes

Description

@steven-barnes

This code uses the double-checked lock pattern:

    public C getConfigurable(@Nullable final UUID kbTenantId) {
        if (kbTenantId != null && !this.configuredTenants.contains(kbTenantId)) {
            synchronized(this.configuredTenants) {
                if (!this.configuredTenants.contains(kbTenantId)) {
                    this.configure(kbTenantId);
                    this.configuredTenants.add(kbTenantId);
                }
            }
        }

        return (C)this.pluginTenantConfigurable.get(kbTenantId);
    }

However configuredTenants can potentially be modified by a different thread while contains is called out side the synchronization block. AFAIK, this is not thread safe.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions