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

Josh Elser commented on ACCUMULO-4369:
--------------------------------------

For those curious about how we got here: if getZooInstance throws a 
RuntimeException, then an IllegalArgumentException would be re-thrown saying 
that the client configuration was invalid/missing. This was because the broad 
catch on Exception was unintentionally catching all RTE's as well.

> Poor exception propagation in Shell#setInstance()
> -------------------------------------------------
>
>                 Key: ACCUMULO-4369
>                 URL: https://issues.apache.org/jira/browse/ACCUMULO-4369
>             Project: Accumulo
>          Issue Type: Bug
>          Components: test
>            Reporter: Josh Elser
>            Assignee: Josh Elser
>             Fix For: 1.7.3, 1.8.0
>
>
> {noformat}
> experimentalPropTest(org.apache.accumulo.test.ShellConfigIT)  Time elapsed: 
> 63.119 sec  <<< ERROR!
> java.lang.IllegalArgumentException: Unable to load client config from 
> /etc/accumulo/conf/client.conf
>   at 
> org.apache.accumulo.fate.zookeeper.ZooSession.connect(ZooSession.java:124)
>   at 
> org.apache.accumulo.fate.zookeeper.ZooSession.getSession(ZooSession.java:164)
>   at 
> org.apache.accumulo.fate.zookeeper.ZooReader.getSession(ZooReader.java:43)
>   at 
> org.apache.accumulo.fate.zookeeper.ZooReader.getZooKeeper(ZooReader.java:47)
>   at 
> org.apache.accumulo.fate.zookeeper.ZooCache.getZooKeeper(ZooCache.java:59)
>   at org.apache.accumulo.fate.zookeeper.ZooCache.retry(ZooCache.java:159)
>   at org.apache.accumulo.fate.zookeeper.ZooCache.get(ZooCache.java:289)
>   at org.apache.accumulo.fate.zookeeper.ZooCache.get(ZooCache.java:238)
>   at 
> org.apache.accumulo.core.client.ZooKeeperInstance.getInstanceID(ZooKeeperInstance.java:169)
>   at 
> org.apache.accumulo.core.client.ZooKeeperInstance.<init>(ZooKeeperInstance.java:159)
>   at 
> org.apache.accumulo.core.client.ZooKeeperInstance.<init>(ZooKeeperInstance.java:140)
>   at org.apache.accumulo.shell.Shell.getZooInstance(Shell.java:498)
>   at org.apache.accumulo.shell.Shell.setInstance(Shell.java:452)
>   at org.apache.accumulo.shell.Shell.config(Shell.java:306)
>   at 
> org.apache.accumulo.test.ShellServerIT$TestShell.<init>(ShellServerIT.java:162)
>   at 
> org.apache.accumulo.test.ShellConfigIT.experimentalPropTest(ShellConfigIT.java:90)
> {noformat}
> This test failed, appearing to state that the test failed because it could 
> not load the client configuration file. However, if you actually inspect the 
> stack trace, it points to the following code:
> {code}
>       if (System.currentTimeMillis() - startTime > 2 * timeout) {
>         throw new RuntimeException("Failed to connect to zookeeper (" + host 
> + ") within 2x zookeeper timeout period " + timeout);
>       }
> {code}
> In fact, the test failed because it failed to connect to the zookeeper server 
> with 2x the ZK session timeout. We should improve this try/catch so that it's 
> actually realistically telling the user what went wrong.



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

Reply via email to