# HG changeset patch # User dfuchs # Date 1521037927 0 # Node ID 9027d1747dd0da638a5742d3404edfa00e282d56 # Parent 065641767a75b2965743c6c9de0dcc4d826e2ba6 http-client-branch: add more diagnosis to detachChannel diff -r 065641767a75 -r 9027d1747dd0 src/java.net.http/share/classes/jdk/internal/net/http/HttpClientImpl.java --- a/src/java.net.http/share/classes/jdk/internal/net/http/HttpClientImpl.java Wed Mar 14 13:35:33 2018 +0000 +++ b/src/java.net.http/share/classes/jdk/internal/net/http/HttpClientImpl.java Wed Mar 14 14:32:07 2018 +0000 @@ -521,7 +521,9 @@ ConnectionPool pool; SelectorManager(HttpClientImpl ref) throws IOException { - super(null, null, "HttpClient-" + ref.id + "-SelectorManager", 0, false); + super(null, null, + "HttpClient-" + ref.id + "-SelectorManager", + 0, false); owner = ref; debug = ref.debug; debugtimeout = ref.debugtimeout; @@ -533,6 +535,7 @@ void detach(SelectableChannel channel, AsyncEvent... events) { if (Thread.currentThread() == this) { + debug.log(Level.DEBUG, "detaching channel"); SelectionKey key = channel.keyFor(selector); if (key != null) { boolean removed = false; @@ -552,8 +555,10 @@ } } registrations.removeAll(Arrays.asList(events)); + debug.log(Level.DEBUG, "channel detached"); } else { synchronized (this) { + debug.log(Level.DEBUG, "scheduling event to detach channel"); deregistrations.add(new AsyncTriggerEvent( (x) -> debug.log(Level.DEBUG, "Unexpected exception raised while detaching channel", x), diff -r 065641767a75 -r 9027d1747dd0 src/java.net.http/share/classes/jdk/internal/net/http/SocketTube.java --- a/src/java.net.http/share/classes/jdk/internal/net/http/SocketTube.java Wed Mar 14 13:35:33 2018 +0000 +++ b/src/java.net.http/share/classes/jdk/internal/net/http/SocketTube.java Wed Mar 14 14:32:07 2018 +0000 @@ -166,7 +166,9 @@ void detach() { if (detached.compareAndSet(false, true)) { + debug.log(Level.DEBUG, "detaching tube"); readPublisher.subscriptionImpl.readScheduler.stop(); + debug.log(Level.DEBUG, "scheduler stopped"); SocketFlowEvent[] events = { readPublisher.subscriptionImpl.readEvent, writeSubscriber.writeEvent @@ -174,6 +176,7 @@ for (SocketFlowEvent event : events) { event.pause(); } + debug.log(Level.DEBUG, "asking HttpClientImpl to detach channel"); client.detachChannel(channel, events); } }