[ 
https://issues.apache.org/jira/browse/GEODE-5252?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16502171#comment-16502171
 ] 

ASF subversion and git services commented on GEODE-5252:
--------------------------------------------------------

Commit b73165836e765298d0cbef692737e9820021219a in geode's branch 
refs/heads/feature/GEODE-5277 from [~sai.boorlaga...@gmail.com]
[ https://gitbox.apache.org/repos/asf?p=geode.git;h=b731658 ]

GEODE-5252: Race in management adapter could fail to create MXBeans. (#1993)

Fixed a race condition which causes the creation of MBeans fail 
while handling resource lifecycle change notifications.
  * A read-write lock is added to synchronize between handling notifications
    of cache creation/removal and handling other notifications.
  * Added a test which to test the synchronization for a fixed amount of time.


> Race in management adapter could fail to create MXBeans.
> --------------------------------------------------------
>
>                 Key: GEODE-5252
>                 URL: https://issues.apache.org/jira/browse/GEODE-5252
>             Project: Geode
>          Issue Type: Bug
>          Components: management
>            Reporter: Sai Boorlagadda
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 2h
>  Remaining Estimate: 0h
>
> Handling DiskStore creation event to create DiskStoreMXBean could result into 
> a null pointer due to race in ManagementAdapter.java.
> {noformat}
> java.lang.NullPointerException
>       at 
> org.apache.geode.management.internal.beans.ManagementAdapter.handleDiskCreation(ManagementAdapter.java:380)
>       at 
> org.apache.geode.management.internal.beans.ManagementListener.handleEvent(ManagementListener.java:122)
>       at 
> org.apache.geode.distributed.internal.InternalDistributedSystem.notifyResourceEventListeners(InternalDistributedSystem.java:2201)
>       at 
> org.apache.geode.distributed.internal.InternalDistributedSystem.handleResourceEvent(InternalDistributedSystem.java:590)
>       at 
> org.apache.geode.internal.cache.DiskStoreFactoryImpl.create(DiskStoreFactoryImpl.java:143)
> {noformat}
> ManagementAdapter.handleDiskCreation throws NullPointerException on line 380 
> which means the thread invoking handleDiskCreation is seeing null for the 
> field service.
> {noformat}
>     service.federate(changedMBeanName, DiskStoreMXBean.class, true);
> {noformat}
> Looks like service is SystemManagementService and it's set to a non-null 
> value in ManagementAdaptor.handleCacheCreation:
> {noformat}
>       this.service =
>           (SystemManagementService) 
> ManagementService.getManagementService(internalCache);
> {noformat}
> The field is not volatile and it's not protected by any synchronization:
> {noformat}
>   /** Internal ManagementService Instance **/
>   private SystemManagementService service;
> {noformat}
> Lots of other fields in ManagementAdaptor also appear to NOT be thread-safe. 
> Looks like ManagementAdaptor concurrency in general needs to be fixed up to 
> fix this bug.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to