[
https://issues.apache.org/jira/browse/SSHD-1085?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17243478#comment-17243478
]
min yun law commented on SSHD-1085:
-----------------------------------
the "REMOTE_COMMAND_WAIT_EVENTS" is from ClientSession.java that defined as :
Set<ClientChannelEvent> REMOTE_COMMAND_WAIT_EVENTS =
Collections.unmodifiableSet(EnumSet.of(ClientChannelEvent.CLOSED));
which Other Event I need to check in this reboot case to avoid the long waiting?
I see in ClientChannelEvent.java which has following monitor status:
/**
* Timeout while waiting for other events - <B>Note:</B> meaningful only as a
member of the <U>returned</U> events
**/
TIMEOUT,
/** Channel has been marked as closed **/
CLOSED,
/** Received STDOUT (a.k.a. channel) data **/
STDOUT_DATA,
/** Received STDERR (a.k.a. extended) data **/
STDERR_DATA,
/** Received EOF signal from remote peer **/
EOF,
/**
* Received exit status from remote peer
*
* @see ClientChannel#getExitStatus()
**/
EXIT_STATUS,
/**
* Received exit signal from remote peer
*
* @see ClientChannel#getExitSignal()
*/
EXIT_SIGNAL,
/** Channel has been successfully opened */
OPENED;
> channel.waitFor() get stuck when run reboot command
> ---------------------------------------------------
>
> Key: SSHD-1085
> URL: https://issues.apache.org/jira/browse/SSHD-1085
> Project: MINA SSHD
> Issue Type: Bug
> Affects Versions: 2.5.1
> Environment: linux
> Reporter: min yun law
> Priority: Minor
>
> 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:
>
> {code:java}
> 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();
> }
>
> {code}
>
> So why the ChannelExec cannot get the correct channel status when remote node
> is rebooting?
>
>
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]