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

Uma Maheswara Rao G commented on HDFS-3618:
-------------------------------------------

Hi Eli, Thanks a lot for taking a look.

 I think we have to handle 127 and 126 code separateltly and return false as 
they indicate command not exist or doesn't have 
permissions.http://theory.uwinnipeg.ca/localfiles/infofiles/bash/bashref_43.html#SEC50

{quote}
Looks like we return ChannelExec#getExitStatus, which may return non-zero 
values, eg -1.
{quote}
When I checked the changeLog of JSCh, I observed below change.

{quote}
•feature: added 'Channel.isClosed()'. Channel.getExitStatus() should be invoked 
after Channel.isClosed()==true.
{quote}

Looking at our code, we are not calling in that way right?
After calling status only we are disconnecting in finally.

{code}
  return exec.getExitStatus();
    } finally {
      cleanup(exec);
    }
{code}

I found a case where we have to call ChannelExec#getExitStatus after 
Channel.isClosed()==true
 do you think we have to hanlde this case?
                
> SSH fencing option may incorrectly succeed if nc (netcat) command not present
> -----------------------------------------------------------------------------
>
>                 Key: HDFS-3618
>                 URL: https://issues.apache.org/jira/browse/HDFS-3618
>             Project: Hadoop HDFS
>          Issue Type: Bug
>          Components: auto-failover
>    Affects Versions: 2.1.0-alpha
>            Reporter: Brahma Reddy Battula
>         Attachments: zkfc.txt, zkfc_threaddump.out
>
>
> Started NN's and zkfc's in Suse11.
> Suse11 will have netcat installation and netcat -z will work(but nc -z wn't 
> work)..
> While executing following command, got command not found hence rc will be 
> other than zero and assuming that server was down..Here we are ending up 
> without checking whether service is down or not..
> {code}
> LOG.info(
>             "Indeterminate response from trying to kill service. " +
>             "Verifying whether it is running using nc...");
>         rc = execCommand(session, "nc -z " + serviceAddr.getHostName() +
>             " " + serviceAddr.getPort());
>         if (rc == 0) {
>           // the service is still listening - we are unable to fence
>           LOG.warn("Unable to fence - it is running but we cannot kill it");
>           return false;
>         } else {
>           LOG.info("Verified that the service is down.");
>           return true;          
>         }
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira


Reply via email to