You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/04/11 07:39:59 UTC

[GitHub] [pulsar] leizhiyuan opened a new issue, #15113: ResourceGroupConfigListener and ResourceGroupNamespaceConfigListener has an cocurrent bug at startrup

leizhiyuan opened a new issue, #15113:
URL: https://github.com/apache/pulsar/issues/15113

   **Describe the bug**
   A clear and concise description of what the bug is.
   
   ```
    public ResourceGroupConfigListener(ResourceGroupService rgService, PulsarService pulsarService) {
           this.rgService = rgService;
           this.pulsarService = pulsarService;
           this.rgResources = pulsarService.getPulsarResources().getResourcegroupResources();
           loadAllResourceGroups(); // THIS IS ASYNC  1 
           this.rgResources.getStore().registerListener(this);
           rgNamespaceConfigListener = new ResourceGroupNamespaceConfigListener(
                   rgService, pulsarService, this);
       }
   ```
    
           loadAllResourceGroups(); // THIS IS ASYNC  1 
    add invoke 
          resourceGroupsMap.put(rgName, rg);
   
   
   ```
       public ResourceGroupNamespaceConfigListener(ResourceGroupService rgService, PulsarService pulsarService,
               ResourceGroupConfigListener rgConfigListener) {
           this.rgService = rgService;
           this.pulsarService = pulsarService;
           this.namespaceResources = pulsarService.getPulsarResources().getNamespaceResources();
           this.tenantResources = pulsarService.getPulsarResources().getTenantResources();
           this.rgConfigListener = rgConfigListener;
           loadAllNamespaceResourceGroups(); // THIS IS ASYNC  2
           this.namespaceResources.getStore().registerListener(this);
       }
   
   ```
   loadAllNamespaceResourceGroups(); // THIS IS ASYNC  2 
   
   will invoke
                   rgService.registerNameSpace(policy.resource_group_name, ns);
   
   then
   ```
      private ResourceGroup checkResourceGroupExists(String rgName) throws PulsarAdminException {
           ResourceGroup rg = this.getResourceGroupInternal(rgName);
           if (rg == null) {
               throw new PulsarAdminException("Resource group does not exist: " + rgName);
           }
           return rg;
       }
   ```
   inside
   ```
       /**
        * Get the RG with the given name. For internal operations only.
        */
       private ResourceGroup getResourceGroupInternal(String resourceGroupName) {
           if (resourceGroupName == null) {
               throw new IllegalArgumentException("Invalid null resource group name: " + resourceGroupName);
           }
   
           return resourceGroupsMap.get(resourceGroupName);
       }
   
   ```
   
   if 2 run earlier than 1, it will occur error, if no resource group is added, it won't recover.
   
   **To Reproduce**
   
   review the code
   
   **Expected behavior**
   A clear and concise description of what you expected to happen.
   
   maybe we need loadAllResourceGroups sync, or when it done, then loadAllNamespaceResourceGroups
   
   **Screenshots**
   If applicable, add screenshots to help explain your problem.
   
   **Desktop (please complete the following information):**
    - OS: [e.g. iOS]
   
   **Additional context**
   Add any other context about the problem here.
   master branch
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] github-actions[bot] commented on issue #15113: ResourceGroupConfigListener and ResourceGroupNamespaceConfigListener has an cocurrent bug at startrup

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on issue #15113:
URL: https://github.com/apache/pulsar/issues/15113#issuecomment-1124458650

   The issue had no activity for 30 days, mark with Stale label.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] github-actions[bot] commented on issue #15113: ResourceGroupConfigListener and ResourceGroupNamespaceConfigListener has an cocurrent bug at startrup

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on issue #15113:
URL: https://github.com/apache/pulsar/issues/15113#issuecomment-1152835555

   The issue had no activity for 30 days, mark with Stale label.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org