Re: HttpClient is not proving to be thread-safe and reusable -- probably user error

2016-06-21 Thread Shawn Heisey
On 6/21/2016 8:56 AM, Pete Keyes wrote: > You failed to consume the response. Apache-HC will never return the > connection to the pool. Once you've hit the 500th thread all > connections are leased. In the run() method simply add a finally to > your try/catch and move the response object into

Re: Telling HC to make new connections all the time

2016-06-21 Thread Oleg Kalnichevski
On Tue, 2016-06-21 at 08:28 -0400, Benson Margulies wrote: > Oleg, If I set a TTL, do I also need an IdleConnectionMonitorThread ( > http://hc.apache.org/httpcomponents-client-ga/tutorial/html/connmgmt.html#d5e652 > )? thanks, benson. > TTL setting only ensures connections cannot get re-used

HttpClient is not proving to be thread-safe and reusable -- probably user error

2016-06-21 Thread Shawn Heisey
At the paste URL below is the code I'm using in a test. The test is checking for race conditions in some server code I've written: http://apaste.info/Vs6 This code will stop working correctly during the second loop. On the first loop, it creates 400 threads and requests the URL once in each

Re: Telling HC to make new connections all the time

2016-06-21 Thread Benson Margulies
Oleg, If I set a TTL, do I also need an IdleConnectionMonitorThread ( http://hc.apache.org/httpcomponents-client-ga/tutorial/html/connmgmt.html#d5e652 )? thanks, benson. On Tue, Jun 21, 2016 at 4:41 AM, Oleg Kalnichevski wrote: > On Mon, 2016-06-20 at 13:57 -0400, Benson

Re: Telling HC to make new connections all the time

2016-06-21 Thread Oleg Kalnichevski
On Mon, 2016-06-20 at 13:57 -0400, Benson Margulies wrote: > We use the async http components library to connect various components > in a system that is deployed, in some cases, on AWS. When it's > deployed on AWS, there are ELBs involved. > > Like some other people, we've having various trauma