Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server side heartbeat not working #298

Closed
thevipwan opened this issue Dec 22, 2022 · 5 comments · Fixed by #303
Closed

Server side heartbeat not working #298

thevipwan opened this issue Dec 22, 2022 · 5 comments · Fixed by #303
Assignees
Labels
bug An issue describing a bug in the code
Milestone

Comments

@thevipwan
Copy link

thevipwan commented Dec 22, 2022

Version

master

Bug description

dependency:

<dependency>
    <groupId>org.apache.sshd</groupId>
    <artifactId>sshd-core</artifactId>
    <version>2.7.0</version>
</dependency>

Code:

SshServer sshd = SshServer.setUpDefaultServer();
sshd.setPort(3333);
sshd.setShellFactory(InteractiveProcessShellFactory.INSTANCE);
sshd.setSessionHeartbeat(SessionHeartbeatController.HeartbeatType.IGNORE, Duration.ofSeconds(5));
sshd.setKeyPairProvider(new ClassLoadableResourceKeyPairProvider(getClass().getClassLoader(), "rsa.key"));
sshd.setPasswordAuthenticator((username, password, session) -> username.equals(password));
sshd.start();
log.info("SSHD server started");

ssh Client:

user/passwd = test

ssh [email protected] -p3333 

Actual behavior

read Server Setup Manual last section

I with my SSHD has ServerSide heartbeat,But setSessionHeartbeat API didn't working, ssh session didn't get any interval heartbeat

Expected behavior

SSHD automatic send heartbeat message for each ssh session

Relevant log output

No response

Other information

No response

@tomaswolf
Copy link
Member

Why did you expect any heartbeats to be sent when you set heartbeat type NONE?

Try SessionHeartbeatController.HeartbeatType.IGNORE.

@thevipwan
Copy link
Author

SessionHeartbeatController.HeartbeatType.IGNORE

Try this, but still can't get any heartbeats

@tomaswolf
Copy link
Member

  1. I see that you are using version 2.7.0. Please try with 2.9.2, or with the master version.
  2. How do you verify whether the client gets heartbeat messages?

@thevipwan
Copy link
Author

switch to version 2.9.2 but still not work;I use debug log and Wireshark(Capture port traffic) monitor heartbeat,I'm so confused about it, can you give me correct example code?

@tomaswolf
Copy link
Member

Indeed; you're right. It looks like this never worked, and was not caught because there was no test for server-side heartbeats.

@tomaswolf tomaswolf reopened this Dec 26, 2022
@tomaswolf tomaswolf self-assigned this Dec 26, 2022
@tomaswolf tomaswolf added the bug An issue describing a bug in the code label Dec 26, 2022
@tomaswolf tomaswolf added this to the 2.9.3 milestone Dec 26, 2022
tomaswolf added a commit to tomaswolf/mina-sshd that referenced this issue Dec 26, 2022
Services need to be started. In particular, the connection service
starts its heartbeat, if configured, when started. It was already
noticed in commit e74e204 that the server-side did not start services,
but at that time the effect was not recognized because tests were too
unstable back then. A test for server-side heartbeats was also missing.
tomaswolf added a commit to tomaswolf/mina-sshd that referenced this issue Dec 26, 2022
Services need to be started. In particular, the connection service
starts its heartbeat, if configured, when started. It was already
noticed in commit e74e204 that the server-side did not start services,
but at that time the effect was not recognized because tests were too
unstable back then. A test for server-side heartbeats was also missing.

Bug: apache#298
tomaswolf added a commit to tomaswolf/mina-sshd that referenced this issue Dec 26, 2022
Services need to be started. In particular, the connection service
starts its heartbeat, if configured, when started. It was already
noticed in commit e74e204 that the server-side did not start services,
but at that time the effect was not recognized because tests were too
unstable back then. A test for server-side heartbeats was also missing.

Bug: apache#298
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An issue describing a bug in the code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants