You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@geode.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2017/01/03 04:42:58 UTC

[jira] [Commented] (GEODE-2236) Attempting to remove all CacheListeners from a Region using gfsh throws NullPointerException

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

ASF GitHub Bot commented on GEODE-2236:
---------------------------------------

GitHub user deepakddixit opened a pull request:

    https://github.com/apache/geode/pull/327

    GEODE-2236: Remove all cache-listners using Gfsh

    Added check before instantiating cache listner class. Added test to verify change.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/deepakddixit/incubator-geode bugfix/GEODE-2236

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/geode/pull/327.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #327
    
----
commit 8fe84be51f2ce5e4a604a440bcf0662f227d69ca
Author: Deepak Dixit <de...@gmail.com>
Date:   2017-01-02T06:34:24Z

    GEODE-2236: Remove all cache-listners using Gfsh
    Added check before instantiating cache listner class. Added test to verify change.

----


> Attempting to remove all CacheListeners from a Region using gfsh throws NullPointerException
> --------------------------------------------------------------------------------------------
>
>                 Key: GEODE-2236
>                 URL: https://issues.apache.org/jira/browse/GEODE-2236
>             Project: Geode
>          Issue Type: Bug
>          Components: gfsh
>            Reporter: Kevin Duling
>            Assignee: Deepak Dixit
>
> The --cache-listener option to the alter region command replaces the existing CacheListeners with the ones set in the option.
> What happens in RegionAlterFunction is that the existing CacheListeners not included in the new list are removed, then the new ones are added.
> So, in theory, to remove all CacheListeners, an empty string could be passed into the --cache-listener option like:
> {noformat}
> alter region --name=data --cache-listener=''
> Executing - alter region --name=data --cache-listener=""
> Member  | Status
> ------- | ----------------------------------------------------------------------
> server2 | ERROR: java.lang.NullPointerException
> 	at com.gemstone.gemfire.manag..
> server1 | ERROR: java.lang.NullPointerException
> 	at com.gemstone.gemfire.manag..
> {noformat}
> This actually works but it throws the NPE below.
> {noformat}
> [error 2016/09/13 09:48:59.943 PDT server1 <Function Execution Processor1> tid=0x40] 
> java.lang.NullPointerException
> 	at com.gemstone.gemfire.management.internal.cli.functions.RegionAlterFunction.newInstance(RegionAlterFunction.java:320)
> 	at com.gemstone.gemfire.management.internal.cli.functions.RegionAlterFunction.alterRegion(RegionAlterFunction.java:228)
> 	at com.gemstone.gemfire.management.internal.cli.functions.RegionAlterFunction.execute(RegionAlterFunction.java:64)
> 	at com.gemstone.gemfire.internal.cache.MemberFunctionStreamingMessage.process(MemberFunctionStreamingMessage.java:185)
> 	at com.gemstone.gemfire.distributed.internal.DistributionMessage.scheduleAction(DistributionMessage.java:386)
> 	at com.gemstone.gemfire.distributed.internal.DistributionMessage$1.run(DistributionMessage.java:457)
> 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
> 	at com.gemstone.gemfire.distributed.internal.DistributionManager.runUntilShutdown(DistributionManager.java:692)
> 	at com.gemstone.gemfire.distributed.internal.DistributionManager$9$1.run(DistributionManager.java:1149)
> 	at java.lang.Thread.run(Thread.java:745)
> {noformat}
> A work-around to this issue is to set a non-existent CacheListener in the --cache-listener option like:
> {noformat}
> alter region --name=data --cache-listener=Fred
> Executing - alter region --name=data --cache-listener=Fred
> Member  | Status
> ------- | ------------------------------------------------------------------
> server1 | ERROR: Could not find class "Fred" specified for "cache-listener".
> server2 | ERROR: Could not find class "Fred" specified for "cache-listener".
> {noformat}
> This correctly throws the ClassNotFoundException below and also removes all the existing CacheListeners.
> {noformat}
> [error 2016/09/13 09:46:40.537 PDT server1 <Function Execution Processor1> tid=0x40] Could not find class "Fred" specified for "cache-listener".
> java.lang.RuntimeException: Could not find class "Fred" specified for "cache-listener".
> 	at com.gemstone.gemfire.management.internal.cli.functions.RegionAlterFunction.forName(RegionAlterFunction.java:306)
> 	at com.gemstone.gemfire.management.internal.cli.functions.RegionAlterFunction.alterRegion(RegionAlterFunction.java:227)
> 	at com.gemstone.gemfire.management.internal.cli.functions.RegionAlterFunction.execute(RegionAlterFunction.java:64)
> 	at com.gemstone.gemfire.internal.cache.MemberFunctionStreamingMessage.process(MemberFunctionStreamingMessage.java:185)
> 	at com.gemstone.gemfire.distributed.internal.DistributionMessage.scheduleAction(DistributionMessage.java:386)
> 	at com.gemstone.gemfire.distributed.internal.DistributionMessage$1.run(DistributionMessage.java:457)
> 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
> 	at com.gemstone.gemfire.distributed.internal.DistributionManager.runUntilShutdown(DistributionManager.java:692)
> 	at com.gemstone.gemfire.distributed.internal.DistributionManager$9$1.run(DistributionManager.java:1149)
> 	at java.lang.Thread.run(Thread.java:745)
> Caused by: java.lang.ClassNotFoundException: Fred
> 	at com.gemstone.gemfire.internal.ClassPathLoader.forName(ClassPathLoader.java:422)
> 	at com.gemstone.gemfire.management.internal.cli.functions.RegionAlterFunction.forName(RegionAlterFunction.java:303)
> 	... 10 more
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)