Do you see the same error if you remove the call to req.releaseConnection() ?
What does the stacktrace in the exception that you see look like? On Sep 19, 2013, at 8:29 AM, Eugene Dzhurinsky <[email protected]> wrote: > Hello! I am facing some strange problem with HttpClient 4.2.5 > > Here is some Scala code: > > val cm = new PoolingClientConnectionManager() > cm.setMaxTotal(100) > > val client = new DefaultHttpClient(cm) > > val params = client.getParams > > params.setParameter("http.socket.timeout", 10000) > params.setParameter("http.tcp.nodelay", true) > params.setParameter("http.connection.timeout", 10000) > params.setParameter("http.connection.stalecheck", false) > > client.setHttpRequestRetryHandler(new HttpRequestRetryHandler { > def retryRequest(exception: IOException, executionCount: Int, context: > HttpContext): Boolean = executionCount < 2 > }) > > def processUrl(url: Record) = { > var req: HttpGet = null > try { > req = new HttpGet(url.toString) > val response = client.execute(req) > val statusLine = response.getStatusLine > ..... > } catch { > case e: Exception => > LOG.error("Exception processing task", e) > } > finally { > if (req != null) { > req.abort() > req.releaseConnection() > } > } > } > > > I hope that it's clear what's going on above - I create instance of > PoolingClientConnectionManager, set total pool size to 100, then I do create > client instance and download content of url in method "processUrl". > > Sometimes when application uses 30 threads to call processUrl, I can see the > error "Connection already open". I've seen the thread about similar issue back > at 2010, but it looks like fixed, and I am not using any > IdleConnectionManager here. > > Please advice. > > Thanks! > > -- > Eugene N Dzhurinsky --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
