[ 
https://issues.apache.org/jira/browse/KNOX-2978?focusedWorklogId=887410&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-887410
 ]

ASF GitHub Bot logged work on KNOX-2978:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 26/Oct/23 14:50
            Start Date: 26/Oct/23 14:50
    Worklog Time Spent: 10m 
      Work Description: zeroflag opened a new pull request, #811:
URL: https://github.com/apache/knox/pull/811

   ## 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.
   
   ```java
     private ServiceDetails getServiceDetails(ServiceDiscoveryConfig 
serviceDiscoveryConfig, ApiService service) {
       return getClusterServices(serviceDiscoveryConfig).getIfPresent(service); 
// <= NPE
     }
   ```
   
   ```java
     @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




Issue Time Tracking
-------------------

            Worklog Id:     (was: 887410)
    Remaining Estimate: 0h
            Time Spent: 10m

> Race condition between Service Discovery and Polling Config Analyzer
> --------------------------------------------------------------------
>
>                 Key: KNOX-2978
>                 URL: https://issues.apache.org/jira/browse/KNOX-2978
>             Project: Apache Knox
>          Issue Type: Improvement
>            Reporter: Attila Magyar
>            Assignee: Attila Magyar
>            Priority: Major
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> 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.
> {code}
>   private ServiceDetails getServiceDetails(ServiceDiscoveryConfig 
> serviceDiscoveryConfig, ApiService service) {
>     return getClusterServices(serviceDiscoveryConfig).getIfPresent(service); 
> // <= NPE
>   }
> {code}
> {code}
>   @Override
>   public void onConfigurationChange(String source, String clusterName) {
>     log.clearServiceDiscoveryRepository();
>     repository.clear(); // this will cause the NPE
>   }
> {code}
> This was observed on a live cluster when certain cluster properties was 
> changed during knox startup.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to