hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: RV: NO_HTTP_RESPONSE_EXCEPTION
Date Wed, 22 Jul 2009 16:41:36 GMT
On Wed, Jul 22, 2009 at 06:06:25PM +0200, Joan Balaguer? Valls wrote:
> Hello Oleg,
> 
> I attach the http log.

Hi Joan,

Unfortunately the log did not get through


 I've been taking a look to this trace, and I've
> observed the following. I don't know if it's important or not.
> 
> In line 53315, we have a request that is correctly processed. When
> HttpClient tries to get a connection from pool, the information is:
> 
> Total connections kept alive: 2
> Total issued connections: 0
> Total allocated connection: 2 out of 100
> Getting free connection [HttpRoute[{}->http://192.168.38.87:80]][null]
> 
> 
> The following request fails with noHttpResponse (starts at line 53362). In
> this request, when HttpClient tries to get a connection from pool, the
> information is:
> 
> Total connections kept alive: 11
> Total issued connections: 0
> Total allocated connection: 11 out of 100
> Getting free connection [HttpRoute[{}->http://192.168.46.152:11003]][null]
> 
> 
> Is it normal that this request shows a pool with 11 allocated connections
> when the previous request only shows 2?
>

It is normal. Those two requests have _completely_ different routes. 

 
> Here, httpNoResponseException starts until the pool is empty. You can see 11
> consecutive erroneous requests with "Connection closed" and "Released
> connection is not reusable" UNTIL "total allocated connection" is 0.
> 
> When "total allocated connection" is 0, HttpClient has to create a new
> connection (line 53713), and then everything works again.
> 

It is all very simple. Those 11 connections have most likely been idle for two
long and therefore got dropped on the server side. You should either use the
stale connection check or implement some sort of a stale connection eviction
policy to make sure HttpClient does not try to re-use them. For details see

http://hc.apache.org/httpcomponents-client/tutorial/html/ch02.html#d4e638

Hope this helps

Oleg




> Well, exactly the same situation is reproduced starting at line 66610.
> In this line, the request goes OK. The information is:
> 
> Total connections kept alive: 2
> Total issued connections: 0
> Total allocated connection: 2 out of 100
> Getting free connection [HttpRoute[{}->http://10.12.112.180:12003]][null]
> 
> 
> The following request again fails, and the information is:
> Total connections kept alive: 10
> Total issued connections: 0
> Total allocated connection: 10 out of 100
> Getting free connection [HttpRoute[{}->http://192.168.46.152:11003]][null]
> 
> Again, we can see 10 consecutive erroneous requests, until allocated
> connections comes 0 again. In this point, everything starts to work again
> when Httpclient has to create a new connection.
> 
> 
> I try to attach the log file as a zip file. Last time it was impossible to
> send it to you. If you don't receive it, tell how I can send it.
> 
> 
> Thanks for your time, Oleg.
> 
> Joan.
> 
> 
> -----Mensaje original-----
> De: Oleg Kalnichevski [mailto:olegk@apache.org] 
> Enviado el: mi?rcoles, 22 de julio de 2009 14:41
> Para: HttpClient User Discussion
> Asunto: Re: RV: NO_HTTP_RESPONSE_EXCEPTION
> 
> On Wed, Jul 22, 2009 at 02:17:17PM +0200, Joan Balaguer? Valls wrote:
> > Hello Oleg,
> > 
> > Five months ago, I sent you the emails below because I was experiencing a
> > lot of NoHttpResponseException errors when sending requests to a couple of
> > servers.
> > 
> > Yesterday night, I installed my app with H4 in one of my clients. This
> > morning I've had to move back to H3 because of these errors.
> > 
> > The app consists of a proxy that is sending requests to 3 different
> > webservices. The app has a different connection pool for each webservice,
> > and the target servers are also different for each one. 
> > 
> > App	-> requests to Webservice1 --> uses pool1 --> send to serversA,B 
> > 	-> requests to Webservice2 --> uses pool2 --> send to serversC,D 
> > 	-> requests to Webservice3 --> uses pool3 --> send to serversE,F
> > 
> > 
> 
> 
> Joan,
> 
> Please post a context / wire log of the HTTP session that exhibits the
> problem
> 
> http://hc.apache.org/httpcomponents-client/logging.html
> 
> Please also consider using the latest HttpClient 4.0 RC build:
> 
> http://people.apache.org/~olegk/httpclient-4.0-rc2/
> 
> Mind you it is very unlikely this has anything to do with HttpClient, so
> expect no miracles.
> 
> Oleg
> 
> 
> 
> > The results for webservice1 are:
> > 
> > Tuesday 22/07:	HttpClient 3.1.	Total Requests sent	:
> 175.003
> > From 00:00 to 23:59			OK Requests 		:
> > 174.936
> > 						Error Requests:		:
> > 67		
> > Wednes. 23/07:	HttpClient 4.0	Total Requests sent	:
> 54.851
> > From 00:00 to 13:30			OK Requests 		:
> > 51.183
> > 						Error Requests:		:
> > 3.668
> > 
> > From these 3.668 errors, 3.647 corresponding to NoHttpResponseException.
> > 
> > 
> > 
> > The error percentages are similar in ws2 and ws3. The target servers for
> the
> > ws1 and ws2 are in the same LAN than my app, while target servers for w3
> are
> > on the Internet.
> > 
> > After moving back to H3, again 0 errors in the last 2 hours.
> > 
> > Please, just tell me what you need to get more information about this
> > problem (traces, configurations, ...). Anything you need.
> > 
> > 
> > Thanks in advance,
> > 
> > Joan.
> > 
> > -----Mensaje original-----
> > De: Oleg Kalnichevski [mailto:olegk@apache.org] 
> > Enviado el: s?bado, 07 de febrero de 2009 14:08
> > Para: HttpClient User Discussion
> > Asunto: Re: NO_HTTP_RESPONSE_EXCEPTION
> > 
> > sebb wrote:
> > > On 06/02/2009, Oleg Kalnichevski <olegk@apache.org> wrote:
> > >> Joan Balaguer? wrote:
> > >>
> > >>> Thanks Oleg. It seems strange to me because HttpClient3 (sending
> > requests
> > >> to
> > >>> the same server) never fails. I'll take a look at the code again and
> > I'll
> > >>> comment you something else.
> > >>>
> > >>>
> > >>  I do not know why the server chokes on packets generated by HttpClient
> > 4,
> > >> but this is clearly a server side problem. The server should return a
> non
> > >> 2xx response if something is not okay, not just drop the connection.
> > >>
> > >>  HTTP/1.0 can be a problem or absence of User-Agent header. Whatever.
> At
> > any
> > >> rate the server is broken.
> > >>
> > >>
> > >>
> > 
> > On Fri, 2009-02-06 at 13:44 +0100, Joan Balaguer? wrote:
> > > Hello Oleg,
> > > 
> > > 
> > > This is the log. I sent 10 concurrent requests, and all of them failed 
> > > with HttpNoResponseException.
> > > 
> > > 
> > > Thanks for you help,
> > > 
> > > Joan.
> > >  
> > 
> > There is nothing wrong with packets generated by HttpClient. This appears
> to
> > be a server side issue. The target server fails to send any valid response
> > back and simply closes the connection.
> > 
> > Oleg
> > 
> > 
> > > -----Mensaje original-----
> > > De: Oleg Kalnichevski [mailto:olegk@apache.org] Enviado el: jueves, 05 
> > > de febrero de 2009 21:44
> > > Para: HttpClient User Discussion
> > > Asunto: Re: NO_HTTP_RESPONSE_EXCEPTION
> > > 
> > > Joan Balaguer? wrote:
> > > > Hello,
> > > > 
> > > >  
> > > > 
> > > > I?m sending requests to one server using HttpClient3 and HttpClient4.
> > > > HttpClient3 works well, but HttpClient4 fails randomly with an 
> > > > ?HttpNoResponseException?.
> > > > 
> > > > This is the trace:
> > > > org.apache.http.NoHttpResponseException: The target server failed to
> > > respond
> > > >         at
> > > org.apache.http.impl.conn.DefaultResponseParser.parseHead(DefaultRespo
> > > nsePar
> > > > ser.java:85)
> > > >         at
> > > org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessagePar
> > > ser.ja
> > > > va:174)
> > > >         at
> > > org.apache.http.impl.AbstractHttpClientConnection.receiveResponseHeade
> > > r(Abst
> > > > ractHttpClientConnection.java:182)
> > > >         at
> > > org.apache.http.impl.conn.DefaultClientConnection.receiveResponseHeade
> > > r(Defa
> > > > ultClientConnection.java:235)
> > > >         at
> > > org.apache.http.impl.conn.AbstractClientConnAdapter.receiveResponseHea
> > > der(Ab
> > > > stractClientConnAdapter.java:259)
> > > >         at
> > > org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpReq
> > > uestEx
> > > > ecutor.java:279)
> > > >         at
> > > org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecut
> > > or.jav
> > > > a:121)
> > > >         at
> > > org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequ
> > > estDir
> > > > ector.java:410)
> > > >         at
> > > org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpCli
> > > ent.ja
> > > > va:555)
> > > >         at
> > > org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpCli
> > > ent.ja
> > > > va:487)
> > > >         at
> > > org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpCli
> > > ent.ja
> > > > va:465)
> > > >         at
> > > > com.vpfw.proxy.services.http.HttpService.sendRequest(HttpService.jav
> > > > a:562)
> > > > 
> > > >  
> > > > Do you know if any other people has had a problem like this?
> > > > 
> > > >
> > > 
> > > Not to my best knowledge.
> > > 
> > > 
> > > Set 'org.apache.http' logging category to DEBUG and post the resulting 
> > > wire / context log to the list. I'll have a look.
> > > 
> > > Oleg
> > > 
> > > > 
> > > > Thanks,
> > 
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> > For additional commands, e-mail: httpclient-users-help@hc.apache.org
> > 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
> 
> 

> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Mime
View raw message