On Tue, 2016-01-26 at 13:30 -0600, Mark Johnson wrote: > Hi Oleg, > > Below is a program that reproduces the hang. It might take a couple of > runs to make this happen - it depends on what thread the callback is > generated on. If it's on the IO Dispatcher thread, we can close the > connection on that thread also and there's no problem. If the callback > comes on the pool-thread the program hangs. The stack trace of the > pool-thread when this happens looks like this: > > Thread [pool-1-thread] (Suspended) <-- I paused it in the debugger > but this is where it stays > owns: SessionRequestImpl (id=44) > waiting for: Thread (id=21) > Object.wait(long) > Thread.join(long) > Thread.join() > InternalHttpAsyncClient(ClosableHttpAsyncClientBase).close() > Testprog$Callback.failed(Exception) > etc.
... > @Override > > public void cancelled() { > > Thread t = Thread.currentThread(); > > System.out.println(t.getName() + ": " + "Request cancelled"); > > try { > > System.out.println(t.getName() + ": " + "Closing client connection"); > > _httpclient.close(); > > } catch (Exception ex) { > > System.out.println(t.getName() + ": " + ex.getMessage()); > > } > > _latch.countDown(); > > } > Good Lord! You are shutting down the client from a callback. Is there a good reason for that? Regardless I'll see if there is a way to avoid a deadlock here. Thanks for the reproducer. Oleg --------------------------------------------------------------------- To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org For additional commands, e-mail: httpclient-users-h...@hc.apache.org