Uploaded image for project: 'MINA SSHD'
  1. MINA SSHD
  2. SSHD-1085

channel.waitFor() get stuck when run reboot command

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Cannot Reproduce
    • 2.5.1
    • None
    • None
    • linux

    Description

      Trying to run linux command "reboot" by mina sshd to remote node, the node is in reboot, but the ClientChannel object still keep open, not in closed status, Here is the logic code in my project:

       

      String command = "reboot";
      ChannelExec channel = clientSession.createExecChannel(command);
      if(!channel.isClosed())
      {
      ByteArrayOutputStream out = new ByteArrayOutputStream(); ByteArrayOutputStream err = new ByteArrayOutputStream(); channel.setOut(out); 
      channel.setErr(err); 
      channel.open().await();  //this passed 
      //follow call will cause stuck 
      Collection<ClientChannelEvent> waitMask = channel.waitFor(REMOTE_COMMAND_WAIT_EVENTS, 0L);  
      String outputStr = new String(out.toByteArray(), StandardCharsets.UTF_8); 
      //some case this will throw runtime exception
       int exitStatus = channel.getExitStatus(); 
      }
       
      

       

      So why the ChannelExec cannot get the correct channel status when remote node is rebooting?

       

       

       

      Attachments

        Activity

          People

            lgoldstein Lyor Goldstein
            minlaw min yun law
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: