[ 
https://issues.apache.org/jira/browse/SSHD-993?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Shengdi updated SSHD-993:
-------------------------
    Description: 
I used 

SshServer sshd = SshServer.setUpDefaultServer(); to start an sshd server.

 

When I connect to server with several terminals, and then I keep connect with 
other terminals, then I can probably find the additional ones. This is 
randomly, and most happens after multiple connecting simultaneously or very 
close, then other connect will cause additional connection

Here is an example,

I connect with 5 terminals very closely, i found 5 connections with netstat, 
this is correct
 TCP 127.0.0.1:63862 127.0.0.1:12399 ESTABLISHED 44444
 TCP 127.0.0.1:63864 127.0.0.1:12399 ESTABLISHED 42764
 TCP 127.0.0.1:63868 127.0.0.1:12399 ESTABLISHED 47036
 TCP 127.0.0.1:63874 127.0.0.1:12399 ESTABLISHED 42516
 TCP 127.0.0.1:63879 127.0.0.1:12399 ESTABLISHED 41704

But then connect one more time, then i found two connection established this 
time, 

TCP 127.0.0.1:63862 127.0.0.1:12399 ESTABLISHED 44444
 TCP 127.0.0.1:63864 127.0.0.1:12399 ESTABLISHED 42764
 TCP 127.0.0.1:63868 127.0.0.1:12399 ESTABLISHED 47036
 TCP 127.0.0.1:63874 127.0.0.1:12399 ESTABLISHED 42516
 TCP 127.0.0.1:63879 127.0.0.1:12399 ESTABLISHED 41704
 {color:#ff0000}TCP 127.0.0.1:63890 127.0.0.1:12399 ESTABLISHED 35316{color}
 {color:#ff0000} TCP 127.0.0.1:63891 127.0.0.1:12399 ESTABLISHED 22568{color}

 

Does anyone have any idea about this? how the additional connection caused?

Great Thanks

 

Cheers

Shengdi

 

 

==================================================

Following is my code example

==================================================

~public class SSHServer {~

 ~private SshServer sshd;~

 ~public SSHServer() {~
 ~sshd = SshServer.setUpDefaultServer();~
 ~}~

 ~public void start() throws IOException {~
 ~sshd.setHost("127.0.0.1");~
 ~sshd.setPort(12399);~
 ~sshd.setKeyPairProvider(new MyKeyProvider());~
 ~sshd.setShellFactory(getShellFactory());~
 ~sshd.setPublickeyAuthenticator(new MyAuthenticator());~
 ~sshd.getProperties().put(SshServer.IDLE_TIMEOUT, String.valueOf(300000));~
 ~// Start SSH server~
 ~sshd.start();~
 ~}~

 ~private Factory<Command> getShellFactory() {~
 ~return new Factory<Command>() {~
 ~@Override~
 ~public Command create() {~
 ~return new MyShell();~
 ~}~
 ~};~
 ~}~

~}~

 

  was:
I used 

SshServer sshd = SshServer.setUpDefaultServer(); to start an sshd server.

 

When I connect to server with several terminals, and then I keep connect with 
other terminals, then I can probably find the additional ones. This is 
randomly, and most happens after multiple connecting simultaneously or very 
close, then other connect will cause additional connection

Here is an example,

I connect with 5 terminals very closely, i found 5 connections with netstat, 
this is correct
 TCP 127.0.0.1:63862 127.0.0.1:12399 ESTABLISHED 44444
 TCP 127.0.0.1:63864 127.0.0.1:12399 ESTABLISHED 42764
 TCP 127.0.0.1:63868 127.0.0.1:12399 ESTABLISHED 47036
 TCP 127.0.0.1:63874 127.0.0.1:12399 ESTABLISHED 42516
 TCP 127.0.0.1:63879 127.0.0.1:12399 ESTABLISHED 41704

But then connect one more time, then i found two connection established this 
time, 

TCP 127.0.0.1:63862 127.0.0.1:12399 ESTABLISHED 44444
 TCP 127.0.0.1:63864 127.0.0.1:12399 ESTABLISHED 42764
 TCP 127.0.0.1:63868 127.0.0.1:12399 ESTABLISHED 47036
 TCP 127.0.0.1:63874 127.0.0.1:12399 ESTABLISHED 42516
 TCP 127.0.0.1:63879 127.0.0.1:12399 ESTABLISHED 41704
 {color:#ff0000}TCP 127.0.0.1:63890 127.0.0.1:12399 ESTABLISHED 35316{color}
 {color:#ff0000} TCP 127.0.0.1:63891 127.0.0.1:12399 ESTABLISHED 22568{color}

 

Does anyone have any idea about this? how the additional connection caused?

Great Thanks

 

Cheers

Shengdi

 

 

==================================================

Following is my code example

==================================================

public class SSHServer {

 private SshServer sshd;

 public SSHServer() {
 sshd = SshServer.setUpDefaultServer();
 }

 public void start() throws IOException {
 sshd.setHost("127.0.0.1");
 sshd.setPort(12399);
 sshd.setKeyPairProvider(new MyKeyProvider());
 sshd.setShellFactory(getShellFactory());
 sshd.setPublickeyAuthenticator(new MyAuthenticator());
 sshd.getProperties().put(SshServer.IDLE_TIMEOUT, String.valueOf(300000));
 // Start SSH server
 sshd.start();
 }

 private Factory<Command> getShellFactory() {
 return new Factory<Command>() {
 @Override
 public Command create() {
 return new MyShell();
 }
 };
 }

}

 


> an additional connection is created when connect to a sshd server
> -----------------------------------------------------------------
>
>                 Key: SSHD-993
>                 URL: https://issues.apache.org/jira/browse/SSHD-993
>             Project: MINA SSHD
>          Issue Type: Bug
>    Affects Versions: 2.1.0
>            Reporter: Shengdi
>            Priority: Minor
>
> I used 
> SshServer sshd = SshServer.setUpDefaultServer(); to start an sshd server.
>  
> When I connect to server with several terminals, and then I keep connect with 
> other terminals, then I can probably find the additional ones. This is 
> randomly, and most happens after multiple connecting simultaneously or very 
> close, then other connect will cause additional connection
> Here is an example,
> I connect with 5 terminals very closely, i found 5 connections with netstat, 
> this is correct
>  TCP 127.0.0.1:63862 127.0.0.1:12399 ESTABLISHED 44444
>  TCP 127.0.0.1:63864 127.0.0.1:12399 ESTABLISHED 42764
>  TCP 127.0.0.1:63868 127.0.0.1:12399 ESTABLISHED 47036
>  TCP 127.0.0.1:63874 127.0.0.1:12399 ESTABLISHED 42516
>  TCP 127.0.0.1:63879 127.0.0.1:12399 ESTABLISHED 41704
> But then connect one more time, then i found two connection established this 
> time, 
> TCP 127.0.0.1:63862 127.0.0.1:12399 ESTABLISHED 44444
>  TCP 127.0.0.1:63864 127.0.0.1:12399 ESTABLISHED 42764
>  TCP 127.0.0.1:63868 127.0.0.1:12399 ESTABLISHED 47036
>  TCP 127.0.0.1:63874 127.0.0.1:12399 ESTABLISHED 42516
>  TCP 127.0.0.1:63879 127.0.0.1:12399 ESTABLISHED 41704
>  {color:#ff0000}TCP 127.0.0.1:63890 127.0.0.1:12399 ESTABLISHED 35316{color}
>  {color:#ff0000} TCP 127.0.0.1:63891 127.0.0.1:12399 ESTABLISHED 22568{color}
>  
> Does anyone have any idea about this? how the additional connection caused?
> Great Thanks
>  
> Cheers
> Shengdi
>  
>  
> ==================================================
> Following is my code example
> ==================================================
> ~public class SSHServer {~
>  ~private SshServer sshd;~
>  ~public SSHServer() {~
>  ~sshd = SshServer.setUpDefaultServer();~
>  ~}~
>  ~public void start() throws IOException {~
>  ~sshd.setHost("127.0.0.1");~
>  ~sshd.setPort(12399);~
>  ~sshd.setKeyPairProvider(new MyKeyProvider());~
>  ~sshd.setShellFactory(getShellFactory());~
>  ~sshd.setPublickeyAuthenticator(new MyAuthenticator());~
>  ~sshd.getProperties().put(SshServer.IDLE_TIMEOUT, String.valueOf(300000));~
>  ~// Start SSH server~
>  ~sshd.start();~
>  ~}~
>  ~private Factory<Command> getShellFactory() {~
>  ~return new Factory<Command>() {~
>  ~@Override~
>  ~public Command create() {~
>  ~return new MyShell();~
>  ~}~
>  ~};~
>  ~}~
> ~}~
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to