You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "mayank.gupta" <gu...@yahoo.com> on 2014/05/27 14:11:38 UTC
Too many Connections are in CLOSE_WAIT state
I am using Camel-Http Component for creating HttpRoutes. I used
MultiThreadedHttpConnectionManager to configure http connection pool and
params. While executing the application , there are too many connections
remains in CLOSE_WAIT state for long time and connections which are idle are
not getting released.
Can you help us , how to close connections which are in CLOSE_WAIT state.
Following snippet code used to configure MultiThreadedHttpConnectionManager
:
final int maxTotalConnection =
Integer.valueOf(PropertyUtils.getProperty("http.maxtotalconnections"));
final int defaultMaxConnectionPerHost =
Integer.valueOf(PropertyUtils.getProperty("http.default.max.total.connections.per.host"));
final int maxConnectionPerHost =
Integer.valueOf(PropertyUtils.getProperty("http.max.connection.per.host"));
final int httpSoTimeOut =
Integer.valueOf(PropertyUtils.getProperty("http.connection.timeout"));
final HttpConnectionManagerParams httpConnectionManagerParams = new
HttpConnectionManagerParams();
httpConnectionManagerParams.setMaxTotalConnections(maxTotalConnection);
httpConnectionManagerParams.setDefaultMaxConnectionsPerHost(defaultMaxConnectionPerHost);
httpConnectionManagerParams.setMaxConnectionsPerHost(HostConfiguration.ANY_HOST_CONFIGURATION,maxConnectionPerHost);
httpConnectionManagerParams.setSoTimeout(httpSoTimeOut);
final MultiThreadedHttpConnectionManager httpConnectionManager = new
MultiThreadedHttpConnectionManager();
httpConnectionManager.setParams(httpConnectionManagerParams);
final HttpComponent http =
context.getComponent(BusinessConstants.HTTP_COMPONENT, HttpComponent.class);
http.setHttpConnectionManager(httpConnectionManager);
Http Headers that we have been used in Request XML :
Accept: text/xml
Authorization: Basic ZmRwcHJvdnVzZXI6ZmRwcHJvdnVzZXI=
Content-Length: 1040
user-agent: UGw Server/4.0/1.0
Connection: Keep-alive
Host: 10.111.51.113:10010
Content-Type: text/xml
Request : XML post over Http
<?xml version="1.0"?>
<methodCall>
<methodName>GetFaFList</methodName>
<params>
<value>
<struct>
<member>
<name>originNodeType</name>
<value>
<string>IVR</string>
</value>
</member>
<member>
<name>originHostName</name>
<value>
<string>ivr001</string>
</value>
</member>
<member>
<name>originTransactionID</name>
<value>
<string>566612</string>
</value>
</member>
<member>
<name>originTimeStamp</name>
<value>
<dateTime.iso8601>20080507T14:15:21+0200</dateTime.iso8601>
</value>
</member>
<member>
<name>subscriberNumber</name>
<value>
<string>8129149806</string>
</value>
</member>
<member>
<name>requestedOwner</name>
<value>
<int>1</int>
</value>
</member>
</struct>
</value>
</params>
</methodCall>
Attach is CLOSE_WAIT connection on production environment , in which
10.2.48.9 is our host address and right side IPs are foreign host.
close_wait.png
<http://camel.465427.n5.nabble.com/file/n5751619/close_wait.png>
Regards ,
Mayank
-----
Regards ,
Mayank Gupta
--
View this message in context: http://camel.465427.n5.nabble.com/Too-many-Connections-are-in-CLOSE-WAIT-state-tp5751619.html
Sent from the Camel - Users mailing list archive at Nabble.com.