[prev in list] [next in list] [prev in thread] [next in thread]
List: httpclient-users
Subject: Re: Workaround for intermittent IllegalArgumentException: host parameter
From: Oleg Kalnichevski <olegk () apache ! org>
Date: 2009-01-10 13:22:51
Message-ID: 4968A12B.5030806 () apache ! org
[Download RAW message or body]
John Kalucki wrote:
> I have a multi-threaded stress test that, when under heavy load concurrently
> opening many HttpClient connections, intermittently receives
> an IllegalArgumentException with the following stack trace:
> Exception in thread "pool-3-thread-24" java.lang.IllegalArgumentException:
> host parameter is null
> at
> org.apache.commons.httpclient.HttpConnection.<init>(HttpConnection.java:206)
> at
> org.apache.commons.httpclient.HttpConnection.<init>(HttpConnection.java:155)
> at
> org.apache.commons.httpclient.SimpleHttpConnectionManager.getConnectionWithTimeout(SimpleHttpConnectionManager.java:175)
> at
> org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:153)
> at
> org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
> at
> org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323)
>
>
> Again- only intermittently under heavy connect load. There appears some sort
> of timing-related error in HttpClient. Perhaps around setting up the
> following chain in HttpMethodDirector.executeMethod, line 134
>
> // Link all parameter collections to form the hierarchy:
> // Global -> HttpClient -> HostConfiguration -> HttpMethod
> this.hostConfiguration.getParams().setDefaults(this.params);
> method.getParams().setDefaults(this.hostConfiguration.getParams());
>
> Possibly the params management is not fully thread-safe, or, the OS, on
> occasion, doesn't resolve the hostname quickly enough. In any case, the
> workaround I've found for this is to explicitly set the HostConfiguration
> before creating the GetMethod:
>
> val manager = new SimpleHttpConnectionManager(true)
> val client = new HttpClient(manager)
>
> // Attempt to work around NTE in HttpConnection.java:206
> val hostConfiguration = new HostConfiguration()
> hostConfiguration.setHost(host, port)
> client.setHostConfiguration(hostConfiguration)
>
> val getter = new GetMethod(url)
>
> So far this has eliminated this intermittent failure.
>
> -John Kalucki
>
Hi John
This sounds like a race condition or synchronization issue to me. What
version of HttpClient are you using? Could you please try to reproduce
the problem with a test case, which ideally should not be dependent on
your local environment.
Oleg
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic