Kevin Duling created GEODE-2236:
-----------------------------------
Summary: 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
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)