Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KNOX-2978 - Race condition between Service Discovery and Polling Config Analyzer #811

Merged
merged 1 commit into from
Oct 27, 2023

Conversation

zeroflag
Copy link
Contributor

What changes were proposed in this pull request?

When a config change is detected by the Polling Config Analyzer then then the cache used by the service discovery will be cleared. If this happens when discovery is in progress then a NullPointerException will happen.

  private ServiceDetails getServiceDetails(ServiceDiscoveryConfig serviceDiscoveryConfig, ApiService service) {
    return getClusterServices(serviceDiscoveryConfig).getIfPresent(service); // <= NPE
  }
  @Override
  public void onConfigurationChange(String source, String clusterName) {
    log.clearServiceDiscoveryRepository();
    repository.clear(); // this will cause the NPE
  }

This was observed on a live cluster when certain cluster properties was changed during knox startup.

How was this patch tested?

  • unit test

Copy link
Contributor

@smolnar82 smolnar82 left a comment

Choose a reason for hiding this comment

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

LGTM

@zeroflag zeroflag self-assigned this Oct 27, 2023
@zeroflag zeroflag merged commit bc4d548 into apache:master Oct 27, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants