Skip to content

8301169: java/net/httpclient/ThrowingSubscribersAsInputStream.java,ThrowingSubscribersAsInputStreamAsync.java, and other httpclient tests failing on windows: Unable to establish loopback connection #3687

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions test/jdk/java/net/httpclient/AbstractThrowingPublishers.java
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,24 @@ protected void testSanityImpl(String uri, boolean sameClient)

String body = response.join().body();
assertEquals(body, Stream.of(BODY.split("\\|")).collect(Collectors.joining()));
if (!sameClient) {
// Wait for the client to be garbage collected.
// we use the ReferenceTracker API rather than HttpClient::close here,
// because these tests inject faults by throwing inside callbacks, which
// is more likely to get HttpClient::close wedged until jtreg times out.
// By using the ReferenceTracker, we will get some diagnosis about what
// is keeping the client alive if it doesn't get GC'ed within the
// expected time frame.
var tracker = TRACKER.getTracker(client);
client = null;
System.gc();
System.out.println(now() + "waiting for client to shutdown: " + tracker.getName());
System.err.println(now() + "waiting for client to shutdown: " + tracker.getName());
var error = TRACKER.check(tracker, 10000);
if (error != null) throw error;
System.out.println(now() + "client shutdown normally: " + tracker.getName());
System.err.println(now() + "client shutdown normally: " + tracker.getName());
}
}
}

Expand Down Expand Up @@ -470,6 +488,24 @@ private void testThrowing(String uri, boolean sameClient,
if (response != null) {
finisher.finish(where, response, thrower);
}
if (!sameClient) {
// Wait for the client to be garbage collected.
// we use the ReferenceTracker API rather than HttpClient::close here,
// because these tests inject faults by throwing inside callbacks, which
// is more likely to get HttpClient::close wedged until jtreg times out.
// By using the ReferenceTracker, we will get some diagnosis about what
// is keeping the client alive if it doesn't get GC'ed within the
// expected time frame.
var tracker = TRACKER.getTracker(client);
client = null;
System.gc();
System.out.println(now() + "waiting for client to shutdown: " + tracker.getName());
System.err.println(now() + "waiting for client to shutdown: " + tracker.getName());
var error = TRACKER.check(tracker, 10000);
if (error != null) throw error;
System.out.println(now() + "client shutdown normally: " + tracker.getName());
System.err.println(now() + "client shutdown normally: " + tracker.getName());
}
}
}

Expand Down
36 changes: 36 additions & 0 deletions test/jdk/java/net/httpclient/AbstractThrowingPushPromises.java
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,24 @@ public void applyPushPromise(HttpRequest initiatingRequest,
assertEquals(promisedBody, promised.uri().toASCIIString());
}
assertEquals(3, pushPromises.size());
if (!sameClient) {
// Wait for the client to be garbage collected.
// we use the ReferenceTracker API rather than HttpClient::close here,
// because these tests inject faults by throwing inside callbacks, which
// is more likely to get HttpClient::close wedged until jtreg times out.
// By using the ReferenceTracker, we will get some diagnosis about what
// is keeping the client alive if it doesn't get GC'ed within the
// expected time frame.
var tracker = TRACKER.getTracker(client);
client = null;
System.gc();
System.out.println(now() + "waiting for client to shutdown: " + tracker.getName());
System.err.println(now() + "waiting for client to shutdown: " + tracker.getName());
var error = TRACKER.check(tracker, 10000);
if (error != null) throw error;
System.out.println(now() + "client shutdown normally: " + tracker.getName());
System.err.println(now() + "client shutdown normally: " + tracker.getName());
}
}
}

Expand Down Expand Up @@ -425,6 +443,24 @@ private <T,U> void testThrowing(String uri, boolean sameClient,
if (response != null) {
finisher.finish(where, req.uri(), response, thrower, promiseMap);
}
if (!sameClient) {
// Wait for the client to be garbage collected.
// we use the ReferenceTracker API rather than HttpClient::close here,
// because these tests inject faults by throwing inside callbacks, which
// is more likely to get HttpClient::close wedged until jtreg times out.
// By using the ReferenceTracker, we will get some diagnosis about what
// is keeping the client alive if it doesn't get GC'ed within the
// expected time frame.
var tracker = TRACKER.getTracker(client);
client = null;
System.gc();
System.out.println(now() + "waiting for client to shutdown: " + tracker.getName());
System.err.println(now() + "waiting for client to shutdown: " + tracker.getName());
var error = TRACKER.check(tracker, 10000);
if (error != null) throw error;
System.out.println(now() + "client shutdown normally: " + tracker.getName());
System.err.println(now() + "client shutdown normally: " + tracker.getName());
}
}
}

Expand Down
36 changes: 36 additions & 0 deletions test/jdk/java/net/httpclient/AbstractThrowingSubscribers.java
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,24 @@ protected void testSanityImpl(String uri, boolean sameClient)
HttpResponse<String> response = client.send(req, handler);
String body = response.body();
assertEquals(URI.create(body).getPath(), URI.create(uri2).getPath());
if (!sameClient) {
// Wait for the client to be garbage collected.
// we use the ReferenceTracker API rather than HttpClient::close here,
// because these tests inject faults by throwing inside callbacks, which
// is more likely to get HttpClient::close wedged until jtreg times out.
// By using the ReferenceTracker, we will get some diagnosis about what
// is keeping the client alive if it doesn't get GC'ed within the
// expected time frame.
var tracker = TRACKER.getTracker(client);
client = null;
System.gc();
System.out.println(now() + "waiting for client to shutdown: " + tracker.getName());
System.err.println(now() + "waiting for client to shutdown: " + tracker.getName());
var error = TRACKER.check(tracker, 10000);
if (error != null) throw error;
System.out.println(now() + "client shutdown normally: " + tracker.getName());
System.err.println(now() + "client shutdown normally: " + tracker.getName());
}
}
}

Expand Down Expand Up @@ -461,6 +479,24 @@ private <T,U> void testThrowing(String uri, boolean sameClient,
if (response != null) {
finisher.finish(where, response, thrower);
}
if (!sameClient) {
// Wait for the client to be garbage collected.
// we use the ReferenceTracker API rather than HttpClient::close here,
// because these tests inject faults by throwing inside callbacks, which
// is more likely to get HttpClient::close wedged until jtreg times out.
// By using the ReferenceTracker, we will get some diagnosis about what
// is keeping the client alive if it doesn't get GC'ed within the
// expected time frame.
var tracker = TRACKER.getTracker(client);
client = null;
System.gc();
System.out.println(now() + "waiting for client to shutdown: " + tracker.getName());
System.err.println(now() + "waiting for client to shutdown: " + tracker.getName());
var error = TRACKER.check(tracker, 10000);
if (error != null) throw error;
System.out.println(now() + "client shutdown normally: " + tracker.getName());
System.err.println(now() + "client shutdown normally: " + tracker.getName());
}
}
}

Expand Down