You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by Willem jiang <wi...@gmail.com> on 2013/02/01 08:39:57 UTC

Re: Camel-http4 component throws Connection refused error

Thanks for reporting this, I just fill a JIRA[1] for it.
I think we need to provide the options let the user get control of connection management.

[1]https://issues.apache.org/jira/browse/CAMEL-6026  

--  
Willem Jiang

Red Hat, Inc.
FuseSource is now part of Red Hat
Web: http://www.fusesource.com | http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
          http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem





On Friday, February 1, 2013 at 3:18 AM, apatel wrote:

> I am getting org.apache.http.conn.HttpHostConnectException exception when i
> use the http4 component in routes, but the same routes work fine if i use
> the http component.  
>  
> When i look at the code, i found below method in
> org.apache.camel.component.http4.HttpComponen create
> ThreadSafeClientConnManager, I am wondering in which place it release the
> connection or sets connTTL( connection lifetime, <=0 implies "infinity"), i
> don't find any place to set connTTL. i can delay the error by setting
> connectionsPerRoute to 10000.
>  
>  
> protected ClientConnectionManager createConnectionManager() {
> SchemeRegistry schemeRegistry = new SchemeRegistry();
>  
> ThreadSafeClientConnManager answer = new
> ThreadSafeClientConnManager(schemeRegistry);
> if (getMaxTotalConnections() > 0) {
> answer.setMaxTotal(getMaxTotalConnections());
> }
> if (getConnectionsPerRoute() > 0) {
> answer.setDefaultMaxPerRoute(getConnectionsPerRoute());
> }
> LOG.info (http://LOG.info)("Created ClientConnectionManager " + answer);
>  
> return answer;
> }
>  
> Thanks,
> Amit Patel
>  
>  
>  
>  
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-http4-component-throws-Connection-refused-error-tp5726673.html
> Sent from the Camel Development mailing list archive at Nabble.com (http://Nabble.com).




Re: Camel-http4 component throws Connection refused error

Posted by "Willem.Jiang" <wi...@gmail.com>.
Sorry to reply you late, I just came back when I was cleaning up the JIRA
issue today.
As you know we don't change the third part dependency version unless it has
some critical bug, I'm afraid you have to use Camel 2.11.0 for the
PoolingClientConnectionManager.

BTW, I just committed the code which you can set the connectionTimeToLive
parameter of PoolingClientConnectionManager from HttpComponent.

Willem



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-http4-component-throws-Connection-refused-error-tp5726673p5729068.html
Sent from the Camel Development mailing list archive at Nabble.com.

Re: Camel-http4 component throws Connection refused error

Posted by apatel <ap...@asg.bellsouth.net>.
We are still validating Apache Camel 2.11.0, but  would you please check
below scenario cause issue or not?
When connection remove from the pool. Are you plane to use
PoolingClientConnectionManager in Apache Camel 2.10.4? 

scenario
====== 
I am more worry about maxTotalConnections connection. If i have 100 routes
and each create 2 connections. we reach the maxTotalConnections. Since we
are not setting connTTL( connection lifetime, <=0 implies "infinity"), so
connection is not remove from connection pool and 101 route will throw
Connection refused error.




--
View this message in context: http://camel.465427.n5.nabble.com/Camel-http4-component-throws-Connection-refused-error-tp5726673p5727565.html
Sent from the Camel Development mailing list archive at Nabble.com.

Re: Camel-http4 component throws Connection refused error

Posted by apatel <ap...@asg.bellsouth.net>.
I will try using Camel 2.11-SNAPSHOT. 

I am more worry about maxTotalConnections connection. If i have 100 routes
and each create 2 connections. we reach the maxTotalConnections. Since we
are not setting connTTL( connection lifetime, <=0 implies "infinity"), so
connection is not remove from connection pool and 101 route will throw
Connection refused error. 



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-http4-component-throws-Connection-refused-error-tp5726673p5726758.html
Sent from the Camel Development mailing list archive at Nabble.com.

Re: Camel-http4 component throws Connection refused error

Posted by Willem jiang <wi...@gmail.com>.
The default max connection per route is 20 , if we don't set it the http client will set it to be 2.  
I'm not sure what's kind of use case you need more than 20 connections at the same time.


--  
Willem Jiang

Red Hat, Inc.
FuseSource is now part of Red Hat
Web: http://www.fusesource.com | http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
          http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem




On Friday, February 1, 2013 at 4:06 PM, Willem jiang wrote:

> Just a heads up. We upgrade the http client to 4.2.x in Camel 2.11.x,  
> We are using the PoolingClientConnectionManager instead, as it has much better default options setting.
> Can you try to run you camel route with latest Camel 2.11-SNAPSHOT to see if the issue is till there?
> BTW, I will try to add more option for managing the connection.
>  
>  
> --  
> Willem Jiang
>  
> Red Hat, Inc.
> FuseSource is now part of Red Hat
> Web: http://www.fusesource.com | http://www.redhat.com
> Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
> http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
> Twitter: willemjiang  
> Weibo: 姜宁willem
>  
>  
>  
>  
>  
> On Friday, February 1, 2013 at 3:39 PM, Willem jiang wrote:
>  
> > Thanks for reporting this, I just fill a JIRA[1] for it.
> > I think we need to provide the options let the user get control of connection management.
> >  
> > [1]https://issues.apache.org/jira/browse/CAMEL-6026  
> >  
> > --  
> > Willem Jiang
> >  
> > Red Hat, Inc.
> > FuseSource is now part of Red Hat
> > Web: http://www.fusesource.com | http://www.redhat.com
> > Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
> > http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
> > Twitter: willemjiang  
> > Weibo: 姜宁willem
> >  
> >  
> >  
> >  
> >  
> > On Friday, February 1, 2013 at 3:18 AM, apatel wrote:
> >  
> > > I am getting org.apache.http.conn.HttpHostConnectException exception when i
> > > use the http4 component in routes, but the same routes work fine if i use
> > > the http component.  
> > >  
> > > When i look at the code, i found below method in
> > > org.apache.camel.component.http4.HttpComponen create
> > > ThreadSafeClientConnManager, I am wondering in which place it release the
> > > connection or sets connTTL( connection lifetime, <=0 implies "infinity"), i
> > > don't find any place to set connTTL. i can delay the error by setting
> > > connectionsPerRoute to 10000.
> > >  
> > >  
> > > protected ClientConnectionManager createConnectionManager() {
> > > SchemeRegistry schemeRegistry = new SchemeRegistry();
> > >  
> > > ThreadSafeClientConnManager answer = new
> > > ThreadSafeClientConnManager(schemeRegistry);
> > > if (getMaxTotalConnections() > 0) {
> > > answer.setMaxTotal(getMaxTotalConnections());
> > > }
> > > if (getConnectionsPerRoute() > 0) {
> > > answer.setDefaultMaxPerRoute(getConnectionsPerRoute());
> > > }
> > > LOG.info (http://LOG.info)("Created ClientConnectionManager " + answer);
> > >  
> > > return answer;
> > > }
> > >  
> > > Thanks,
> > > Amit Patel
> > >  
> > >  
> > >  
> > >  
> > > --
> > > View this message in context: http://camel.465427.n5.nabble.com/Camel-http4-component-throws-Connection-refused-error-tp5726673.html
> > > Sent from the Camel Development mailing list archive at Nabble.com (http://Nabble.com).
> >  
>  




Re: Camel-http4 component throws Connection refused error

Posted by Willem jiang <wi...@gmail.com>.
Just a heads up. We upgrade the http client to 4.2.x in Camel 2.11.x,  
We are using the PoolingClientConnectionManager instead, as it has much better default options setting.
Can you try to run you camel route with latest Camel 2.11-SNAPSHOT to see if the issue is till there?
BTW, I will try to add more option for managing the connection.


--  
Willem Jiang

Red Hat, Inc.
FuseSource is now part of Red Hat
Web: http://www.fusesource.com | http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
          http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem





On Friday, February 1, 2013 at 3:39 PM, Willem jiang wrote:

> Thanks for reporting this, I just fill a JIRA[1] for it.
> I think we need to provide the options let the user get control of connection management.
>  
> [1]https://issues.apache.org/jira/browse/CAMEL-6026  
>  
> --  
> Willem Jiang
>  
> Red Hat, Inc.
> FuseSource is now part of Red Hat
> Web: http://www.fusesource.com | http://www.redhat.com
> Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
> http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
> Twitter: willemjiang  
> Weibo: 姜宁willem
>  
>  
>  
>  
>  
> On Friday, February 1, 2013 at 3:18 AM, apatel wrote:
>  
> > I am getting org.apache.http.conn.HttpHostConnectException exception when i
> > use the http4 component in routes, but the same routes work fine if i use
> > the http component.  
> >  
> > When i look at the code, i found below method in
> > org.apache.camel.component.http4.HttpComponen create
> > ThreadSafeClientConnManager, I am wondering in which place it release the
> > connection or sets connTTL( connection lifetime, <=0 implies "infinity"), i
> > don't find any place to set connTTL. i can delay the error by setting
> > connectionsPerRoute to 10000.
> >  
> >  
> > protected ClientConnectionManager createConnectionManager() {
> > SchemeRegistry schemeRegistry = new SchemeRegistry();
> >  
> > ThreadSafeClientConnManager answer = new
> > ThreadSafeClientConnManager(schemeRegistry);
> > if (getMaxTotalConnections() > 0) {
> > answer.setMaxTotal(getMaxTotalConnections());
> > }
> > if (getConnectionsPerRoute() > 0) {
> > answer.setDefaultMaxPerRoute(getConnectionsPerRoute());
> > }
> > LOG.info (http://LOG.info)("Created ClientConnectionManager " + answer);
> >  
> > return answer;
> > }
> >  
> > Thanks,
> > Amit Patel
> >  
> >  
> >  
> >  
> > --
> > View this message in context: http://camel.465427.n5.nabble.com/Camel-http4-component-throws-Connection-refused-error-tp5726673.html
> > Sent from the Camel Development mailing list archive at Nabble.com (http://Nabble.com).
>