You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by Chi Shin Hsu <fo...@gmail.com> on 2013/01/04 15:35:32 UTC

Timeout exception caused by http 500 error

I'm trying using fluent client, but getting a strange issue.

Here is the pseudo code
-----------------------------------------
public String get(String url) throw Exception
{
   return .Get("http://somehost/")
        .connectTimeout(1000)
        .socketTimeout(1000)
        .execute().returnContent().asString();
}

int main()
{
   try
   {
   get("urlA");
   }
   catch(Exception e)
           e.printstack();

    try
   {
   get("urlB");
   }
   catch(Exception e)
           e.printstack();

}
-------------------------
Here is the problem

If I enter the first get function, get a http 500 exception.
Then get urlB , it would block until the socket timeout, and throw a
timeout exception.

urlB can be executed in front of urlA

Moreover, I traced the flow by wireshark.
The server actually send a response by urlB, but it still caused timeout
exception
any solution?

Thanks.

Re: Timeout exception caused by http 500 error

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Fri, 2013-01-04 at 22:35 +0800, Chi Shin Hsu wrote:
> I'm trying using fluent client, but getting a strange issue.
> 
> Here is the pseudo code
> -----------------------------------------
> public String get(String url) throw Exception
> {
>    return .Get("http://somehost/")
>         .connectTimeout(1000)
>         .socketTimeout(1000)
>         .execute().returnContent().asString();
> }
> 
> int main()
> {
>    try
>    {
>    get("urlA");
>    }
>    catch(Exception e)
>            e.printstack();
> 
>     try
>    {
>    get("urlB");
>    }
>    catch(Exception e)
>            e.printstack();
> 
> }
> -------------------------
> Here is the problem
> 
> If I enter the first get function, get a http 500 exception.
> Then get urlB , it would block until the socket timeout, and throw a
> timeout exception.
> 
> urlB can be executed in front of urlA
> 
> Moreover, I traced the flow by wireshark.
> The server actually send a response by urlB, but it still caused timeout
> exception
> any solution?
> 
> Thanks.

Generate a wire / context log of the session as described here [1] and
post it to this list.

Oleg

[1] http://hc.apache.org/httpcomponents-client-ga/logging.html




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