[jira] [Commented] (SSHD-1328) Hanging while executing rsync commands.
[ https://issues.apache.org/jira/browse/SSHD-1328?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17728973#comment-17728973 ] sivaprasad commented on SSHD-1328: -- Is there any solution to overcome the resync command hanging issue, can you suggest code modification of the above code, thanks. > Hanging while executing rsync commands. > > > Key: SSHD-1328 > URL: https://issues.apache.org/jira/browse/SSHD-1328 > Project: MINA SSHD > Issue Type: Bug > Environment: Linux and Solaris >Reporter: sivaprasad >Priority: Blocker > > Hi Team, > I hope all are doing great, I'm using Mina to execute remote commands > execution and file uploads/downloads. everything is working fine, but while > executing rsync commands( this command will take more than 1hr to complete) > Mina is hanging forever and not returning anything. > I have added HEARTBEAT in my code, but Mina is printing command output after > command execution is completed but I need to print command output parallel > with command execution. > I have attached my code, can someone look into this and help me to resolve > this issue’s. > > Thanks, > Siva. -- This message was sent by Atlassian Jira (v8.20.10#820010) - To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org For additional commands, e-mail: dev-h...@mina.apache.org
[jira] [Commented] (SSHD-1328) Hanging while executing rsync commands.
[ https://issues.apache.org/jira/browse/SSHD-1328?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17728918#comment-17728918 ] sivaprasad commented on SSHD-1328: -- Hi [~gnodet], Thanks for the response, I updated the format, can you please check. Thanks, Siva. > Hanging while executing rsync commands. > > > Key: SSHD-1328 > URL: https://issues.apache.org/jira/browse/SSHD-1328 > Project: MINA SSHD > Issue Type: Bug > Environment: Linux and Solaris >Reporter: sivaprasad >Priority: Blocker > > Hi Team, > I hope all are doing great, I'm using Mina to execute remote commands > execution and file uploads/downloads. everything is working fine, but while > executing rsync commands( this command will take more than 1hr to complete) > Mina is hanging forever and not returning anything. > I have added HEARTBEAT in my code, but Mina is printing command output after > command execution is completed but I need to print command output parallel > with command execution. > I have attached my code, can someone look into this and help me to resolve > this issue’s. > > Thanks, > Siva. -- This message was sent by Atlassian Jira (v8.20.10#820010) - To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org For additional commands, e-mail: dev-h...@mina.apache.org
[jira] [Commented] (SSHD-1328) Hanging while executing rsync commands.
[ https://issues.apache.org/jira/browse/SSHD-1328?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17728233#comment-17728233 ] Guillaume Nodet commented on SSHD-1328: --- Could you reformat the code so that it's readable and provide the debug output log of the execution ? > Hanging while executing rsync commands. > > > Key: SSHD-1328 > URL: https://issues.apache.org/jira/browse/SSHD-1328 > Project: MINA SSHD > Issue Type: Bug > Environment: Linux and Solaris >Reporter: sivaprasad >Priority: Blocker > > Hi Team, > I hope all are doing great, I'm using Mina to execute remote commands > execution and file uploads/downloads. everything is working fine, but while > executing rsync commands( this command will take more than 1hr to complete) > Mina is hanging forever and not returning anything. > I have added HEARTBEAT in my code, but Mina is printing command output after > command execution is completed but I need to print command output parallel > with command execution. > I have attached my code, can someone look into this and help me to resolve > this issue’s. > > Thanks, > Siva. -- This message was sent by Atlassian Jira (v8.20.10#820010) - To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org For additional commands, e-mail: dev-h...@mina.apache.org
[jira] [Commented] (SSHD-1328) Hanging while executing rsync commands.
[ https://issues.apache.org/jira/browse/SSHD-1328?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17728094#comment-17728094 ] sivaprasad commented on SSHD-1328: -- Hi [~gnodet] / [~twolf], can you please help me to overcome this, thanks for your time. > Hanging while executing rsync commands. > > > Key: SSHD-1328 > URL: https://issues.apache.org/jira/browse/SSHD-1328 > Project: MINA SSHD > Issue Type: Bug > Environment: Linux and Solaris >Reporter: sivaprasad >Priority: Blocker > > Hi Team, > I hope all are doing great, I'm using Mina to execute remote commands > execution and file uploads/downloads. everything is working fine, but while > executing rsync commands( this command will take more than 1hr to complete) > Mina is hanging forever and not returning anything. > I have added HEARTBEAT in my code, but Mina is printing command output after > command execution is completed but I need to print command output parallel > with command execution. > I have attached my code, can someone look into this and help me to resolve > this issue’s. > > Thanks, > Siva. -- This message was sent by Atlassian Jira (v8.20.10#820010) - To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org For additional commands, e-mail: dev-h...@mina.apache.org
[jira] [Commented] (SSHD-1328) Hanging while executing rsync commands.
[ https://issues.apache.org/jira/browse/SSHD-1328?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17727165#comment-17727165 ] sivaprasad commented on SSHD-1328: -- {code:java} public static final Duration HEARTBEAT = Duration.ofSeconds(10L); public static CmdResultBean executeCommandWithMina(String hostname, String username, String password, String command) throws Exception { String line = null; SshClient client = null; ClientSession session = null; ClientChannel channel = null; CmdResultBean outBean = new CmdResultBean(); List> gloHandlers = null; BufferedReader bufferedReader = null; String errorop = null; BufferedReader errorReader = null; StringBuffer stringBuffer = null; long defaultTime = 86400; int defaultport = 22; try { System.out.println("- in minassh command execution."); client = SshClient.setUpDefaultClient();client.start(); gloHandlers = client.getGlobalRequestHandlers(); client.setGlobalRequestHandlers(Collections.singletonList(new AbstractConnectionServiceRequestHandler() { @Override public Result process(ConnectionService connectionService, String request, boolean wantReply, Buffer buffer) throws Exception { connectionService.process(255, buffer); return Result.Replied; } })); CoreModuleProperties.HEARTBEAT_INTERVAL.set(client, HEARTBEAT); CoreModuleProperties.HEARTBEAT_REPLY_WAIT.set(client, Duration.ofSeconds(5L)); session = client.connect(username, hostname, defaultport).verify(defaultTime, TimeUnit.SECONDS).getSession(); session.addPasswordIdentity(password); AuthFuture authFeature = session.auth().verify(defaultTime, TimeUnit.SECONDS); session.setSessionHeartbeat(HeartbeatType.IGNORE, Duration.ofSeconds(5L)); CoreModuleProperties.HEARTBEAT_INTERVAL.set(session, HEARTBEAT); CoreModuleProperties.HEARTBEAT_REPLY_WAIT.set(session, Duration.ofSeconds(5L)); boolean isConnected = authFeature.isSuccess(); if (isConnected){ channel = session.createChannel(Channel.CHANNEL_EXEC, command); channel.open().verify(defaultTime, TimeUnit.SECONDS); CoreModuleProperties.HEARTBEAT_INTERVAL.set(channel, HEARTBEAT); CoreModuleProperties.HEARTBEAT_REPLY_WAIT.set(channel, Duration.ofSeconds(5L)); channel.waitFor(EnumSet.of(ClientChannelEvent.CLOSED), defaultTime); InputStream stdout = new StreamGobbler(channel.getInvertedOut()); bufferedReader = new BufferedReader(new InputStreamReader(stdout, StandardCharsets.UTF_8)); InputStream errorout = new StreamGobbler(channel.getInvertedErr()); errorReader = new BufferedReader(new InputStreamReader(errorout, StandardCharsets.UTF_8)); stringBuffer = new StringBuffer(); while ((line = bufferedReader.readLine()) != null) { System.out.println(line); stringBuffer.append(line + "\n"); } while ((errorop = errorReader.readLine()) != null) { System.out.println(errorop); stringBuffer.append(errorop + "\n");} } else { System.out.println(" *** Unable to authenticate user."); } } catch (Exception e) { line = "127"; e.printStackTrace();throw e;} finally { line = channel.getExitStatus() == null ? "127" : "" + channel.getExitStatus(); String cmdOutput = (stringBuffer.toString() != null && !"".equalsIgnoreCase(stringBuffer.toString())) ? stringBuffer.toString():outBean.setCommand(command); outBean.setStatus(line); outBean.setOutput(cmdOutput.substring(0, cmdOutput.length() - 1)); System.out.println("- exit status of command : " + line);