观察CachingsessionFactory中的内存泄漏(默认sftpSessionFactory)
我们已经建立了Spring Microservice,该微服务将春季集成框架与兔子MQ用作消息系统。我们的应用程序与SFTP服务器建立了SFTP会话,并每3秒钟对文件进行轮询。一天中,我们将获得5oo文件,我们使用CachesessionFactory
和defaultSessionFactory
,带有Spring Integration版本5.2.3。但是,我们观察到三个三个不同的问题:
- 在整个时间内,在生产中,我们观察到内存泄漏。有很多
sftpsession
对象在存储器中浮出水面。 - 间歇性地,我们正在遇到错误,因为“无法获得汇总项目”。
- 一到两次,我们观察到投票程序的线程被卡住了,必须重新启动系统。
=“ nofollow noreferrer ”这种简单的默认空间和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(默认sftpsessionFactory defaultsftpsessionFactory){ CachingsessionFactory CSF =新的CachingsessionFactory(DefaultSftPsessionFactory); 返回CSF; }
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;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论