We have build spring microservice which uses spring integration framework with Rabbit mq as messaging system. Our application establish the sftp session with SFTP server and poll the files every 3 seconds. In a day we get around 5oo files and we are using CacheSessionFactory
and DefaultSessionFactory
with spring integration version 5.2.3. However, we observed three 3 different issues :
- Over the period of time , in production we observed that there is memory leak. There are lots of
SftpSession
objects are remining in memory. - Intermittently we are getting error as "Failed to obtain Pooled item".
- One or 2 time, we observed the Poller thread is getting stuck and had to restart the system.
Number of SFTP session objects
We have this simple instantiation of DefaultSessionFactory and CacheSessionFactory.
DefaultSftpSessionFactory sessionFactory = new DefaultSftpSessionFactory();
sessionFactory.setHost(sftpHost);
sessionFactory.setPort(sftpPort);
sessionFactory.setUser(sftpUser);
sessionFactory.setPassword(sftpPassword);
sessionFactory.setAllowUnknownKeys(true);
return sessionFactory;
}
public CachingSessionFactory cachingSessionFactory(DefaultSftpSessionFactory defaultSftpSessionFactory) { CachingSessionFactory csf = new CachingSessionFactory(defaultSftpSessionFactory); return csf; }