[ https://issues.apache.org/jira/browse/GEODE-7746?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17031954#comment-17031954 ]
ASF subversion and git services commented on GEODE-7746: -------------------------------------------------------- Commit b73daaa00a480a14489c34e33a932617be4ddd6b in geode's branch refs/heads/feature/GEODE-7746 from Jianxia Chen [ https://gitbox.apache.org/repos/asf?p=geode.git;h=b73daaa ] GEODE-7746: Fix the NullPointerException Add null check and throw NoAvailableServersException > An onServers function throws a NullPointerException if the distributed system > is shutdown > ----------------------------------------------------------------------------------------- > > Key: GEODE-7746 > URL: https://issues.apache.org/jira/browse/GEODE-7746 > Project: Geode > Issue Type: Bug > Components: functions > Reporter: Barrett Oglesby > Assignee: Jianxia Chen > Priority: Major > Labels: GeodeCommons > > I have a distributed system with a locator and 3 servers. I then start a > client executing an onServers function forever. > The client is doing this in a loop: > {noformat} > FunctionService.onServers(this.cache).execute("TestFunction").getResult(); > {noformat} > If I stop the distributed system using gfsh like: > {noformat} > gfsh shutdown --include-locators=true > {noformat} > The client throws a NullPointerException like: > {noformat} > org.apache.geode.cache.execute.FunctionException: > java.lang.NullPointerException > at > org.apache.geode.internal.cache.execute.ServerFunctionExecutor.executeOnServer(ServerFunctionExecutor.java:234) > at > org.apache.geode.internal.cache.execute.ServerFunctionExecutor.executeFunction(ServerFunctionExecutor.java:104) > at > org.apache.geode.internal.cache.execute.ServerFunctionExecutor.execute(ServerFunctionExecutor.java:368) > at > org.apache.geode.internal.cache.execute.ServerFunctionExecutor.execute(ServerFunctionExecutor.java:377) > at TestClient.executeFunction(TestClient.java:23) > at TestClient.executeFunctionForever(TestClient.java:34) > at TestClient.main(TestClient.java:15) > Caused by: java.lang.NullPointerException > at > org.apache.geode.cache.client.internal.ExecuteFunctionOp.constructAndGetFunctionTasks(ExecuteFunctionOp.java:131) > at > org.apache.geode.cache.client.internal.ExecuteFunctionOp.execute(ExecuteFunctionOp.java:79) > at > org.apache.geode.internal.cache.execute.ServerFunctionExecutor.executeOnServer(ServerFunctionExecutor.java:217) > {noformat} > The NPNullPointerExceptionE is in > ExecuteFunctionOp.constructAndGetFunctionTasks here: > {noformat} > List<ServerLocation> servers = pool.getConnectionSource().getAllServers(); > {noformat} > In this case, servers is null. -- This message was sent by Atlassian Jira (v8.3.4#803005)