[jira] [Comment Edited] (SSHD-1328) Hanging while executing rsync commands.

2023-06-02 Thread sivaprasad (Jira)


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

sivaprasad edited comment on SSHD-1328 at 6/3/23 4:52 AM:
--

{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 
{
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
{
try
{
line = (channel == null || 
channel.getExitStatus() == null)? "127" : ""+channel.getExitStatus();
String cmdOutput = ( stringBuffer != null && 
Strings.isNotEmpty(str

[jira] [Commented] (SSHD-1328) Hanging while executing rsync commands.

2023-06-02 Thread sivaprasad (Jira)


[ 
https://issues.apache.org/jira/browse/SSHD-1328?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=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] [Comment Edited] (SSHD-1328) Hanging while executing rsync commands.

2023-06-02 Thread sivaprasad (Jira)


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

sivaprasad edited comment on SSHD-1328 at 6/3/23 4:50 AM:
--


{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
{
try
{
line = (channel == null || 
channel.getExitStatus() == null)? "127" : ""+channel.getExitStatus();
   

[jira] [Comment Edited] (SSHD-1328) Hanging while executing rsync commands.

2023-06-02 Thread sivaprasad (Jira)


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

sivaprasad edited comment on SSHD-1328 at 6/3/23 4:48 AM:
--

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
{
try
{
line = (channel == null || 
channel.getExitStatus() == null)? "127" : ""+channel.getExitStatus();

[GitHub] [mina-sshd] tomaswolf commented on a diff in pull request #347: Update docs

2023-06-02 Thread via GitHub


tomaswolf commented on code in PR #347:
URL: https://github.com/apache/mina-sshd/pull/347#discussion_r1214522184


##
docs/server-setup.md:
##
@@ -45,8 +45,7 @@ implementation that you can use if you want. This 
implementation will create a p
 so it's mostly useful to launch the OS native shell. E.g.,
 
 ```java
-sshd.setShellFactory(new ProcessShellFactory(new String[] { "/bin/sh", "-i", 
"-l" }));
-
+sshServer.setShellFactory(new ProcessShellFactory("/bin/sh -i -l", "-i", "-l" 
));
 ```

Review Comment:
   It's worse, but understandable if you look at existing uses. `command` is 
supposed to be the full command as it was received, `elements` is supposed to 
be the individual parts. The correct invocation is
   ```
   new ProcessShellFactory("/bin/sh -i -l", "/bin/sh", "-i", "-l")
   ```
   (This is from memory; I'm not at my development machine where I could easily 
double-check this.)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


-
To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org
For additional commands, e-mail: dev-h...@mina.apache.org



Re: [VOTE] Apache MINA 2.2.2, 2.1.7, 2.0.24 releases

2023-06-02 Thread Jonathan Valliere
+3

On Thu, Jun 1, 2023 at 6:58 PM Emmanuel Lécharny 
wrote:

> hi!
>
> WARNING: there are 3 votes to cast!
>
>
> This is a vote for a triple release:
> * MINA 2.2.2
> * MINA 2.1.7
> * MINA 2.0.24
>
> Those versions are fixing some SSL/TLS issues and bring some added
> features:
> DIRMINA-1122: support for endpoint identification algorithm (thanks to
> Marcin L)
> DIRMINA-1157: A fix for a sporadic SSL/TLS connection establishement for
> version 2.0.X and 2.1.X (thanks to  Steffen Liersch)
> DIRMINA-1169: A fix in the Acceptor for  Java 11 and upper (thanks to
> Thomas Wolf)
>
>
> Temporary tags have been created (they can be removed if the vote is not
> approved) :
>
> * MINA 2.2.2:
>
> https://github.com/apache/mina/commit/bd0b2da0c1993c5bbb5498c5542a263e2a69e554
> * MINA 2.1.7:
>
> https://github.com/apache/mina/commit/f112272a3c1c84aad650a2772d82fcf4ac87
> * MINA 2.0.24:
>
> https://github.com/apache/mina/commit/ff0dd253fe1416951ebffd2f622bfcb56e5873d3
>
>
>
> The final artifacts are stored in a staging repository:
> * MINA 2.2.2:
> https://repository.apache.org/content/repositories/orgapachemina-1082
> * MINA 2.1.7:
> https://repository.apache.org/content/repositories/orgapachemina-1084
> * MINA 2.0.24:
> https://repository.apache.org/content/repositories/orgapachemina-1083
>
>
>
> The distributions are available for download on :
> * MINA 2.2.2: https://dist.apache.org/repos/dist/dev/mina/mina/2.2.2
> * MINA 2.1.7: https://dist.apache.org/repos/dist/dev/mina/mina/2.1.7
> * MINA 2.0.24: https://dist.apache.org/repos/dist/dev/mina/mina/2.0.24
>
>
> Let us vote :
> [ ] +1 | Release MINA 2.2.2
> [ ] ± | Abstain
> [ ] -1 | Do *NOT* release MINA 2.2.2
>
> [ ] +1 | Release MINA 2.1.7
> [ ] ± | Abstain
> [ ] -1 | Do *NOT* release MINA 2.1.7
>
>
> [ ] +1 | Release MINA 2.0.24
> [ ] ± | Abstain
> [ ] -1 | Do *NOT* release MINA 2.0.24
>
> --
> *Emmanuel Lécharny - CTO* 205 Promenade des Anglais – 06200 NICE
> 
> T. +33 (0)4 89 97 36 50
> P. +33 (0)6 08 33 32 61
> emmanuel.lecha...@busit.com https://www.busit.com/
>
> -
> To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org
> For additional commands, e-mail: dev-h...@mina.apache.org
>
> --
CONFIDENTIALITY NOTICE: The contents of this email message and any
attachments are intended solely for the addressee(s) and may contain
confidential and/or privileged information and may be legally protected
from disclosure.


[GitHub] [mina-sshd] thachlp commented on a diff in pull request #347: Update docs

2023-06-02 Thread via GitHub


thachlp commented on code in PR #347:
URL: https://github.com/apache/mina-sshd/pull/347#discussion_r1214096086


##
docs/server-setup.md:
##
@@ -45,8 +45,7 @@ implementation that you can use if you want. This 
implementation will create a p
 so it's mostly useful to launch the OS native shell. E.g.,
 
 ```java
-sshd.setShellFactory(new ProcessShellFactory(new String[] { "/bin/sh", "-i", 
"-l" }));
-
+sshServer.setShellFactory(new ProcessShellFactory("/bin/sh -i -l", "-i", "-l" 
));
 ```

Review Comment:
   So we should fix the implementation. After trying what you suggested, it 
didn't work for me. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


-
To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org
For additional commands, e-mail: dev-h...@mina.apache.org



RE: [VOTE] Apache MINA 2.2.2, 2.1.7, 2.0.24 releases

2023-06-02 Thread Christoph John
Let us vote :
[ X] +1 | Release MINA 2.2.2
[ ] ± | Abstain
[ ] -1 | Do *NOT* release MINA 2.2.2

[ X] +1 | Release MINA 2.1.7
[ ] ± | Abstain
[ ] -1 | Do *NOT* release MINA 2.1.7


[ X] +1 | Release MINA 2.0.24
[ ] ± | Abstain
[ ] -1 | Do *NOT* release MINA 2.0.24

-Original Message-
From: Emmanuel Lécharny 
Sent: 02 June 2023 00:59
To: dev@mina.apache.org
Subject: [VOTE] Apache MINA 2.2.2, 2.1.7, 2.0.24 releases

hi!

WARNING: there are 3 votes to cast!


This is a vote for a triple release:
* MINA 2.2.2
* MINA 2.1.7
* MINA 2.0.24

Those versions are fixing some SSL/TLS issues and bring some added features:
DIRMINA-1122: support for endpoint identification algorithm (thanks to Marcin L)
DIRMINA-1157: A fix for a sporadic SSL/TLS connection establishement for 
version 2.0.X and 2.1.X (thanks to  Steffen Liersch)
DIRMINA-1169: A fix in the Acceptor for  Java 11 and upper (thanks to Thomas 
Wolf)


Temporary tags have been created (they can be removed if the vote is not
approved) :

* MINA 2.2.2:
https://github.com/apache/mina/commit/bd0b2da0c1993c5bbb5498c5542a263e2a69e554
* MINA 2.1.7:
https://github.com/apache/mina/commit/f112272a3c1c84aad650a2772d82fcf4ac87
* MINA 2.0.24:
https://github.com/apache/mina/commit/ff0dd253fe1416951ebffd2f622bfcb56e5873d3



The final artifacts are stored in a staging repository:
* MINA 2.2.2:
https://repository.apache.org/content/repositories/orgapachemina-1082
* MINA 2.1.7:
https://repository.apache.org/content/repositories/orgapachemina-1084
* MINA 2.0.24:
https://repository.apache.org/content/repositories/orgapachemina-1083



The distributions are available for download on :
* MINA 2.2.2: https://dist.apache.org/repos/dist/dev/mina/mina/2.2.2
* MINA 2.1.7: https://dist.apache.org/repos/dist/dev/mina/mina/2.1.7
* MINA 2.0.24: https://dist.apache.org/repos/dist/dev/mina/mina/2.0.24


Let us vote :
[ ] +1 | Release MINA 2.2.2
[ ] ± | Abstain
[ ] -1 | Do *NOT* release MINA 2.2.2

[ ] +1 | Release MINA 2.1.7
[ ] ± | Abstain
[ ] -1 | Do *NOT* release MINA 2.1.7


[ ] +1 | Release MINA 2.0.24
[ ] ± | Abstain
[ ] -1 | Do *NOT* release MINA 2.0.24

--
*Emmanuel Lécharny - CTO* 205 Promenade des Anglais - 06200 NICE T. +33 (0)4 89 
97 36 50 P. +33 (0)6 08 33 32 61 emmanuel.lecha...@busit.com 
https://www.busit.com/

-
To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org For additional 
commands, e-mail: dev-h...@mina.apache.org


-
To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org
For additional commands, e-mail: dev-h...@mina.apache.org