【发布时间】:2014-11-20 15:31:28
【问题描述】:
Camel http 组件没有正确关闭连接?
通过以下路线,我观察到正在服务器上创建连接,但没有终止。 一段时间后,这会导致问题
java.io.IOException: Too many open files
路线:
from("seda:testSeda?concurrentConsumers=20")
.setHeader("Connection", constant("Close"))
.to("http://testServer/testFile.xml?authMethod=Basic&throwExceptionOnFailure=false&authUsername=user&authPassword=password")
.to("file://abc")
.end();
连接处于Close_Wait状态有什么想法吗?
我在 2.14 版本中使用 camel-http 库
【问题讨论】:
-
您确定不是 Camel 客户端以外的其他进程导致了这个问题吗?在 Unix 上,您可以使用
netstat来检查。 -
我确定。我将尝试切换到 http4 客户端,因为我可以看到它在我正在使用的 2.14 版本中支持 maxTotalConnections 和 connectionsPerRoute。我明天更新。
-
是的,camel-http 中可能缺少一些东西。我认为我们没有检测到最终用户是否已将 Connection 标头设置为 Close。随时登录 JIRA 票证:camel.apache.org/support
-
我刚刚查看了HttpProducer的代码,它在处理方法结束时调用了method.releaseConnection()。
-
即使使用 ProducerTemplate 和 HTTP 组件,连接也不会被释放。请提出建议。
标签: java apache-camel