Our team has an application where a file is fetched and handled once per day from a remote server using Spring Integration SFTP. Right now, I am migrating from Spring Boot 2.7 to Spring Boot 3.
After migrating to Spring Boot 3, I have noticed that the following is logged (on WARN level) every minute:
2023-08-15T15:00:48.427+02:00 WARN 21256 --- []-nio2-thread-3] i.DefaultSftpClient$SftpChannelSubsystem : handleUnknownChannelRequest(SftpChannelSubsystem[id=0, recipient=0]-ClientSessionImpl[<username>@<host>/<ip>:<port>][sftp]) Unknown channel request: keepalive@openssh.com[want-reply=true]
2023-08-15T15:01:48.430+02:00 WARN 21256 --- [-nio2-thread-13] i.DefaultSftpClient$SftpChannelSubsystem : handleUnknownChannelRequest(SftpChannelSubsystem[id=0, recipient=0]-ClientSessionImpl[<username>@<host>/<ip>:<port>][sftp]) Unknown channel request: keepalive@openssh.com[want-reply=true]
I assume that this is the Keepalive request sent from the server to the client. Why can't our application handle that request? The warning message was not shown before migrating to Spring Boot 3.
Even though the client can't handle the keepalive requests from the server, it still fetches files as it should. The problem is that the log file will be full of all these unnecessary warning messages, and we will not be able to see other important logs.
This is our Spring Bean for the SessionFactory
@Bean
public SessionFactory<SftpClient.DirEntry> sftpSessionFactory() {
final DefaultSftpSessionFactory factory = new DefaultSftpSessionFactory(true);
factory.setHost(sftpHost);
factory.setPort(sftpPort);
factory.setUser(sftpUser);
if (sftpPrivateKey != null) {
factory.setPrivateKey(sftpPrivateKey);
factory.setPrivateKeyPassphrase(sftpPrivateKeyPassphrase);
} else {
factory.setPassword(sftpPassword);
}
factory.setAllowUnknownKeys(true);
return new CachingSessionFactory<>(factory);
}