You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@geode.apache.org by "ASF subversion and git services (JIRA)" <ji...@apache.org> on 2018/03/16 17:18:00 UTC

[jira] [Commented] (GEODE-4827) Cq should not be added to the cq map if cq's base region is null

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

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

Commit c5b44019dd21847f9f79fc1fbfcf78df70f660e0 in geode's branch refs/heads/develop from [~nabarunnag]
[ https://gitbox.apache.org/repos/asf?p=geode.git;h=c5b4401 ]

GEODE-4827: CQ not added to cq map on exception (#1602)

        * Log level set to info when FilterProfile gets an exception while registering CQ
	* Before, when there is an exception while registering cq like while cache closing the cq's base region is null
	* There is an exception which is logged in debug level but execution continues and adds the cq to the cp map with base region set to null
	* This results in a NullPointerException while closing cq as methods are executed on null region
	* Now the operation to put the cq into the cq map is inside a if check for null cq base region.

> Cq should not be added to the cq map if cq's base region is null
> ----------------------------------------------------------------
>
>                 Key: GEODE-4827
>                 URL: https://issues.apache.org/jira/browse/GEODE-4827
>             Project: Geode
>          Issue Type: Bug
>          Components: cq
>            Reporter: nabarun
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> Currently while registering a cq if the cache is closing down , it throws an exception. but we ignore the exception and continue adding the cq to the map.
> While processing the closing of cq it will ask for the cq's base region which will be null. Thus ends with NPE because we end up calling methods on null region.
> Solution:
> put the addition of the cq to the cqMap inside a if check for base region 
> {code:java}
>  void processRegisterCq(String serverCqName, ServerCQ ServerCQ, boolean addToCqMap,
>       GemFireCacheImpl cache) {
>     ServerCQ cq = (ServerCQ) ServerCQ;
>     try {
>       CqService cqService = cache.getCqService();
>       cqService.start();
>       cq.setCqService(cqService);
>       CqStateImpl cqState = (CqStateImpl) cq.getState();
>       cq.setName(generateCqName(serverCqName));
>       cq.registerCq(null, null, cqState.getState());
>     } catch (Exception ex) {
>       // Change it to Info level.
>       logger.info("Error while initializing the CQs with FilterProfile for CQ {}, Error : {}",
>           serverCqName, ex.getMessage(), ex);
>     }
>     if (logger.isDebugEnabled()) {
>       logger.debug("Adding CQ to remote members FilterProfile using name: {}", serverCqName);
>     }
>     // The region's FilterProfile is accessed through CQ reference as the
>     // region is not set on the FilterProfile created for the peer nodes.
>     if (cq.getCqBaseRegion() != null) {
>       if (addToCqMap) {
>         this.cqs.put(serverCqName, cq);
>       }
>       FilterProfile pf = cq.getCqBaseRegion().getFilterProfile();
>       if (pf != null) {
>         pf.incCqCount();
>       }
>     }
>   }
> {code}



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