Skip to content
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

Update http-core and http-client dependencies #46549

Merged
merged 3 commits into from
Sep 11, 2019
Merged
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
4 changes: 2 additions & 2 deletions buildSrc/version.properties
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ bouncycastle = 1.61
# test dependencies
randomizedrunner = 2.7.1
junit = 4.12
httpclient = 4.5.8
httpcore = 4.4.11
httpclient = 4.5.10
httpcore = 4.4.12
httpasyncclient = 4.1.4
commonslogging = 1.1.3
commonscodec = 1.11
Expand Down
1 change: 1 addition & 0 deletions client/rest/licenses/httpclient-4.5.10.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7ca2e4276f4ef95e4db725a8cd4a1d1e7585b9e5
1 change: 0 additions & 1 deletion client/rest/licenses/httpclient-4.5.8.jar.sha1

This file was deleted.

1 change: 0 additions & 1 deletion client/rest/licenses/httpcore-4.4.11.jar.sha1

This file was deleted.

1 change: 1 addition & 0 deletions client/rest/licenses/httpcore-4.4.12.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
21ebaf6d532bc350ba95bd81938fa5f0e511c132
1 change: 0 additions & 1 deletion client/rest/licenses/httpcore-nio-4.4.11.jar.sha1

This file was deleted.

1 change: 1 addition & 0 deletions client/rest/licenses/httpcore-nio-4.4.12.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
84cd29eca842f31db02987cfedea245af020198b
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;

import java.io.IOException;
import java.net.ConnectException;
Expand Down Expand Up @@ -75,6 +74,7 @@ public static void startHttpServer() throws Exception {
int numHttpServers = randomIntBetween(2, 4);
httpServers = new HttpServer[numHttpServers];
httpHosts = new HttpHost[numHttpServers];
waitForCancelHandler = new WaitForCancelHandler();
for (int i = 0; i < numHttpServers; i++) {
HttpServer httpServer = createHttpServer();
httpServers[i] = httpServer;
Expand All @@ -99,24 +99,30 @@ private static HttpServer createHttpServer() throws Exception {
for (int statusCode : getAllStatusCodes()) {
httpServer.createContext(pathPrefix + "/" + statusCode, new ResponseHandler(statusCode));
}
waitForCancelHandler = new WaitForCancelHandler();
httpServer.createContext(pathPrefix + "/wait", waitForCancelHandler);
return httpServer;
}

private static class WaitForCancelHandler implements HttpHandler {
private CountDownLatch cancelHandlerLatch;
private volatile CountDownLatch requestCameInLatch;
private volatile CountDownLatch cancelHandlerLatch;

void reset() {
cancelHandlerLatch = new CountDownLatch(1);
requestCameInLatch = new CountDownLatch(1);
}

void cancelDone() {
cancelHandlerLatch.countDown();
}

void awaitRequest() throws InterruptedException {
requestCameInLatch.await();
}

@Override
public void handle(HttpExchange exchange) throws IOException {
requestCameInLatch.countDown();
try {
cancelHandlerLatch.await();
} catch (InterruptedException ignore) {
Expand Down Expand Up @@ -225,16 +231,14 @@ public void onFailure(Exception exception) {
}
}

@Ignore("https://github.com/elastic/elasticsearch/issues/45577")
public void testCancelAsyncRequests() throws Exception {
int numRequests = randomIntBetween(5, 20);
final CountDownLatch latch = new CountDownLatch(numRequests);
final List<Response> responses = new CopyOnWriteArrayList<>();
final List<Exception> exceptions = new CopyOnWriteArrayList<>();
for (int i = 0; i < numRequests; i++) {
CountDownLatch latch = new CountDownLatch(1);
waitForCancelHandler.reset();
final String method = RestClientTestUtil.randomHttpMethod(getRandom());
Cancellable cancellable = restClient.performRequestAsync(new Request(method, "/wait"), new ResponseListener() {
Cancellable cancellable = restClient.performRequestAsync(new Request("GET", "/wait"), new ResponseListener() {
@Override
public void onSuccess(Response response) {
responses.add(response);
Expand All @@ -247,10 +251,15 @@ public void onFailure(Exception exception) {
latch.countDown();
}
});
if (randomBoolean()) {
//we wait for the request to get to the server-side otherwise we almost always cancel
// the request artificially on the client-side before even sending it
waitForCancelHandler.awaitRequest();
}
cancellable.cancel();
waitForCancelHandler.cancelDone();
assertTrue(latch.await(5, TimeUnit.SECONDS));
}
assertTrue(latch.await(5, TimeUnit.SECONDS));
assertEquals(0, responses.size());
assertEquals(numRequests, exceptions.size());
for (Exception exception : exceptions) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ private HttpServer createHttpServer() throws Exception {
return httpServer;
}

private class WaitForCancelHandler implements HttpHandler {
private static class WaitForCancelHandler implements HttpHandler {

private final CountDownLatch cancelHandlerLatch = new CountDownLatch(1);

Expand Down Expand Up @@ -259,6 +259,8 @@ public void onFailure(Exception exception) {
/**
* This test verifies some assumptions that we rely upon around the way the async http client works when reusing the same request
* throughout multiple retries, and the use of the {@link HttpRequestBase#abort()} method.
* In fact the low-level REST client reuses the same request instance throughout multiple retries, and relies on the http client
* to set the future ref to the request properly so that when abort is called, the proper future gets cancelled.
*/
public void testRequestResetAndAbort() throws Exception {
try (CloseableHttpAsyncClient client = HttpAsyncClientBuilder.create().build()) {
Expand All @@ -273,10 +275,15 @@ public void testRequestResetAndAbort() throws Exception {
{
httpGet.reset();
assertFalse(httpGet.isAborted());
httpGet.abort();//this has no effect on the next call (although isAborted will return true until the next reset)
httpGet.abort();
Future<HttpResponse> future = client.execute(httpHost, httpGet, null);
assertEquals(200, future.get().getStatusLine().getStatusCode());
assertFalse(future.isCancelled());
try {
future.get();
fail("expected cancellation exception");
} catch(CancellationException e) {
//expected
}
assertTrue(future.isCancelled());
}
{
httpGet.reset();
Expand Down
1 change: 1 addition & 0 deletions client/sniffer/licenses/httpclient-4.5.10.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7ca2e4276f4ef95e4db725a8cd4a1d1e7585b9e5
1 change: 0 additions & 1 deletion client/sniffer/licenses/httpclient-4.5.8.jar.sha1

This file was deleted.

1 change: 0 additions & 1 deletion client/sniffer/licenses/httpcore-4.4.11.jar.sha1

This file was deleted.

1 change: 1 addition & 0 deletions client/sniffer/licenses/httpcore-4.4.12.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
21ebaf6d532bc350ba95bd81938fa5f0e511c132
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7ca2e4276f4ef95e4db725a8cd4a1d1e7585b9e5

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
21ebaf6d532bc350ba95bd81938fa5f0e511c132
1 change: 1 addition & 0 deletions plugins/discovery-ec2/licenses/httpclient-4.5.10.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7ca2e4276f4ef95e4db725a8cd4a1d1e7585b9e5
1 change: 0 additions & 1 deletion plugins/discovery-ec2/licenses/httpclient-4.5.8.jar.sha1

This file was deleted.

1 change: 0 additions & 1 deletion plugins/discovery-ec2/licenses/httpcore-4.4.11.jar.sha1

This file was deleted.

1 change: 1 addition & 0 deletions plugins/discovery-ec2/licenses/httpcore-4.4.12.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
21ebaf6d532bc350ba95bd81938fa5f0e511c132
1 change: 1 addition & 0 deletions plugins/discovery-gce/licenses/httpclient-4.5.10.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7ca2e4276f4ef95e4db725a8cd4a1d1e7585b9e5
1 change: 0 additions & 1 deletion plugins/discovery-gce/licenses/httpclient-4.5.8.jar.sha1

This file was deleted.

1 change: 0 additions & 1 deletion plugins/discovery-gce/licenses/httpcore-4.4.11.jar.sha1

This file was deleted.

1 change: 1 addition & 0 deletions plugins/discovery-gce/licenses/httpcore-4.4.12.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
21ebaf6d532bc350ba95bd81938fa5f0e511c132
1 change: 1 addition & 0 deletions plugins/repository-gcs/licenses/httpclient-4.5.10.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7ca2e4276f4ef95e4db725a8cd4a1d1e7585b9e5
1 change: 0 additions & 1 deletion plugins/repository-gcs/licenses/httpclient-4.5.8.jar.sha1

This file was deleted.

1 change: 0 additions & 1 deletion plugins/repository-gcs/licenses/httpcore-4.4.11.jar.sha1

This file was deleted.

1 change: 1 addition & 0 deletions plugins/repository-gcs/licenses/httpcore-4.4.12.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
21ebaf6d532bc350ba95bd81938fa5f0e511c132
1 change: 1 addition & 0 deletions plugins/repository-s3/licenses/httpclient-4.5.10.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7ca2e4276f4ef95e4db725a8cd4a1d1e7585b9e5
1 change: 0 additions & 1 deletion plugins/repository-s3/licenses/httpclient-4.5.8.jar.sha1

This file was deleted.

1 change: 0 additions & 1 deletion plugins/repository-s3/licenses/httpcore-4.4.11.jar.sha1

This file was deleted.

1 change: 1 addition & 0 deletions plugins/repository-s3/licenses/httpcore-4.4.12.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
21ebaf6d532bc350ba95bd81938fa5f0e511c132
1 change: 1 addition & 0 deletions x-pack/plugin/core/licenses/httpclient-4.5.10.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7ca2e4276f4ef95e4db725a8cd4a1d1e7585b9e5
1 change: 0 additions & 1 deletion x-pack/plugin/core/licenses/httpclient-4.5.8.jar.sha1

This file was deleted.

1 change: 0 additions & 1 deletion x-pack/plugin/core/licenses/httpcore-4.4.11.jar.sha1

This file was deleted.

1 change: 1 addition & 0 deletions x-pack/plugin/core/licenses/httpcore-4.4.12.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
21ebaf6d532bc350ba95bd81938fa5f0e511c132
1 change: 0 additions & 1 deletion x-pack/plugin/core/licenses/httpcore-nio-4.4.11.jar.sha1

This file was deleted.

1 change: 1 addition & 0 deletions x-pack/plugin/core/licenses/httpcore-nio-4.4.12.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
84cd29eca842f31db02987cfedea245af020198b
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
b195778247a21e980cb9f80c41364dc0c38feaef

This file was deleted.

1 change: 1 addition & 0 deletions x-pack/snapshot-tool/licenses/httpclient-4.5.10.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7ca2e4276f4ef95e4db725a8cd4a1d1e7585b9e5
1 change: 0 additions & 1 deletion x-pack/snapshot-tool/licenses/httpclient-4.5.8.jar.sha1

This file was deleted.

1 change: 0 additions & 1 deletion x-pack/snapshot-tool/licenses/httpcore-4.4.11.jar.sha1

This file was deleted.

1 change: 1 addition & 0 deletions x-pack/snapshot-tool/licenses/httpcore-4.4.12.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
21ebaf6d532bc350ba95bd81938fa5f0e511c132