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

Rajat Khandelwal commented on LENS-853:
---------------------------------------

Hey [~raju.bairishetti] I'm getting the following:

{noformat}
Exception in thread "Thread-4" java.lang.IllegalStateException: Unable to close 
lens connection with params LensConnectionParams{dbName='default', 
baseUrl='http://0.0.0.0:9999/lensapi', user=anonymous, lensConfs={}, 
lensVars={}, sessionVars={}}
        at org.apache.lens.client.LensConnection.close(LensConnection.java:206)
        at 
org.apache.lens.client.LensClient.closeConnection(LensClient.java:326)
        at 
org.apache.lens.cli.commands.BaseLensCommand.closeClientConnection(BaseLensCommand.java:92)
        at 
org.apache.lens.cli.commands.BaseLensCommand$2.run(BaseLensCommand.java:81)
Exception in thread "Thread-11" java.lang.IllegalStateException: Unable to 
close lens connection with params LensConnectionParams{dbName='default', 
baseUrl='http://0.0.0.0:9999/lensapi', user=anonymous, lensConfs={}, 
lensVars={}, sessionVars={}}
        at org.apache.lens.client.LensConnection.close(LensConnection.java:206)
        at 
org.apache.lens.client.LensClient.closeConnection(LensClient.java:326)
        at 
org.apache.lens.cli.commands.BaseLensCommand.closeClientConnection(BaseLensCommand.java:92)
        at 
org.apache.lens.cli.commands.BaseLensCommand$2.run(BaseLensCommand.java:81)
Exception in thread "Thread-3" java.lang.IllegalStateException: Unable to close 
lens connection with params LensConnectionParams{dbName='default', 
baseUrl='http://0.0.0.0:9999/lensapi', user=anonymous, lensConfs={}, 
lensVars={}, sessionVars={}}
        at org.apache.lens.client.LensConnection.close(LensConnection.java:206)
        at 
org.apache.lens.client.LensClient.closeConnection(LensClient.java:326)
        at 
org.apache.lens.cli.commands.BaseLensCommand.closeClientConnection(BaseLensCommand.java:92)
        at 
org.apache.lens.cli.commands.BaseLensCommand$2.run(BaseLensCommand.java:81)
Exception in thread "Thread-7" Exception in thread "Thread-5" 
java.lang.IllegalStateException: Unable to close lens connection with params 
LensConnectionParams{dbName='default', baseUrl='http://0.0.0.0:9999/lensapi', 
user=anonymous, lensConfs={}, lensVars={}, sessionVars={}}
        at org.apache.lens.client.LensConnection.close(LensConnection.java:206)
        at 
org.apache.lens.client.LensClient.closeConnection(LensClient.java:326)
        at 
org.apache.lens.cli.commands.BaseLensCommand.closeClientConnection(BaseLensCommand.java:92)
        at 
org.apache.lens.cli.commands.BaseLensCommand$2.run(BaseLensCommand.java:81)
java.lang.IllegalStateException: Unable to close lens connection with params 
LensConnectionParams{dbName='default', baseUrl='http://0.0.0.0:9999/lensapi', 
user=anonymous, lensConfs={}, lensVars={}, sessionVars={}}
        at org.apache.lens.client.LensConnection.close(LensConnection.java:206)
        at 
org.apache.lens.client.LensClient.closeConnection(LensClient.java:326)
        at 
org.apache.lens.cli.commands.BaseLensCommand.closeClientConnection(BaseLensCommand.java:92)
        at 
org.apache.lens.cli.commands.BaseLensCommand$2.run(BaseLensCommand.java:81)
$
{noformat}

on running a command file from lens-cli using --cmdfile option. 

I believe this may be related to the shutdown hook getting called multiple 
times. 

Can you add a follow-up patch which only closes connection if it's not closed?

> Quitting shell(quitshell()) is not closing session some times.
> --------------------------------------------------------------
>
>                 Key: LENS-853
>                 URL: https://issues.apache.org/jira/browse/LENS-853
>             Project: Apache Lens
>          Issue Type: Bug
>          Components: client
>            Reporter: Raju Bairishetti
>            Assignee: Raju Bairishetti
>              Labels: newbie
>             Fix For: 2.6
>
>         Attachments: LENS-853.patch, LENS-853_01.patch
>
>
> Quitting session through programmatically is not closing the session some 
> times. 
> First it checks whether connection to server is active or not to close the 
> session. It is depending on isConnectionActive variable to check the 
> connection is active or not. Right now we are setting isConnectionActive to 
> true only  if user calls  getClient(). isConnectionActive should be set to 
> true when user calls setClient(client). 
> code snippets:
> ----------------
> {code}
>   public LensClient getClient() {
>     if (lensClient == null) {
>       setClient(getClientWrapper().getClient());
>       isConnectionActive = true;
>     }
>     return lensClient;
>   }
> {code}
> {code}
> protected static synchronized void closeClientConnection() {
>     if (isConnectionActive) {
>       log.debug("Request for stopping lens cli received");
>       getClientWrapper().getClient().closeConnection();
>       isConnectionActive = false;
>     }
>   }
> {code}



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

Reply via email to