From 92fa76a642b09ec95b79d7d7f1f7ae639a0af68f Mon Sep 17 00:00:00 2001 From: Jason Tedor Date: Sat, 9 Jun 2018 14:47:06 -0400 Subject: [PATCH] Upgrade to Netty 4.1.25.Final This commit upgrades us to Netty 4.1.25. This upgrade is more challenging than past upgrades, all because of a new object cleaner thread that they have added. This thread requires an additional security permission (set context class loader, needed to avoid leaks in certain scenarios). Additionally, there is not a clean way to shutdown this thread which means that the thread can fail thread leak control during tests. As such, we have to filter this thread from thread leak control. --- modules/transport-netty4/build.gradle | 16 ++++---- .../netty-buffer-4.1.16.Final.jar.sha1 | 1 - .../netty-buffer-4.1.25.Final.jar.sha1 | 1 + .../netty-codec-4.1.16.Final.jar.sha1 | 1 - .../netty-codec-4.1.25.Final.jar.sha1 | 1 + .../netty-codec-http-4.1.16.Final.jar.sha1 | 1 - .../netty-codec-http-4.1.25.Final.jar.sha1 | 1 + .../netty-common-4.1.16.Final.jar.sha1 | 1 - .../netty-common-4.1.25.Final.jar.sha1 | 1 + .../netty-handler-4.1.16.Final.jar.sha1 | 1 - .../netty-handler-4.1.25.Final.jar.sha1 | 1 + .../netty-resolver-4.1.16.Final.jar.sha1 | 1 - .../netty-resolver-4.1.25.Final.jar.sha1 | 1 + .../netty-transport-4.1.16.Final.jar.sha1 | 1 - .../netty-transport-4.1.25.Final.jar.sha1 | 1 + .../plugin-metadata/plugin-security.policy | 2 + .../http/netty4/Netty4BadRequestTests.java | 4 +- .../http/netty4/Netty4HttpChannelTests.java | 4 +- .../Netty4HttpPipeliningHandlerTests.java | 4 +- .../netty4/Netty4HttpRequestSizeLimitIT.java | 5 +-- .../Netty4HttpServerPipeliningTests.java | 4 +- .../Netty4HttpServerTransportTests.java | 4 +- .../http/netty4/Netty4PipeliningIT.java | 4 +- .../Netty4IntegTestCase.java} | 8 ++-- .../elasticsearch/test/Netty4TestCase.java | 26 +++++++++++++ .../test/ObjectCleanerThreadThreadFilter.java | 37 +++++++++++++++++++ .../netty4/ByteBufBytesReferenceTests.java | 5 ++- .../transport/netty4/ESLoggingHandlerIT.java | 4 +- .../netty4/Netty4ScheduledPingTests.java | 4 +- .../Netty4SizeHeaderFrameDecoderTests.java | 4 +- .../transport/netty4/Netty4TransportIT.java | 4 +- ...Netty4TransportMultiPortIntegrationIT.java | 4 +- .../Netty4TransportPublishAddressIT.java | 4 +- .../netty4/NettyTransportMultiPortTests.java | 4 +- .../netty4/SimpleNetty4TransportTests.java | 3 ++ plugins/transport-nio/build.gradle | 16 ++++---- .../netty-buffer-4.1.16.Final.jar.sha1 | 1 - .../netty-buffer-4.1.25.Final.jar.sha1 | 1 + .../netty-codec-4.1.16.Final.jar.sha1 | 1 - .../netty-codec-4.1.25.Final.jar.sha1 | 1 + .../netty-codec-http-4.1.16.Final.jar.sha1 | 1 - .../netty-codec-http-4.1.25.Final.jar.sha1 | 1 + .../netty-common-4.1.16.Final.jar.sha1 | 1 - .../netty-common-4.1.25.Final.jar.sha1 | 1 + .../netty-handler-4.1.16.Final.jar.sha1 | 1 - .../netty-handler-4.1.25.Final.jar.sha1 | 1 + .../netty-resolver-4.1.16.Final.jar.sha1 | 1 - .../netty-resolver-4.1.25.Final.jar.sha1 | 1 + .../netty-transport-4.1.16.Final.jar.sha1 | 1 - .../netty-transport-4.1.25.Final.jar.sha1 | 1 + .../plugin-metadata/plugin-security.policy | 2 + .../AbstractLicensesIntegrationTestCase.java | 5 ++- .../license/StartBasicLicenseTests.java | 1 + .../test/ObjectCleanerThreadThreadFilter.java | 23 ++++++++++++ .../test/XPackIntegTestCase.java | 13 +++++++ .../test/XPackSingleNodeTestCase.java | 13 +++++++ .../xpack/ml/support/BaseMlIntegTestCase.java | 32 +++++++++++----- .../plugin-metadata/plugin-security.policy | 2 + .../test/SecurityIntegTestCase.java | 4 +- .../test/SecuritySingleNodeTestCase.java | 4 +- .../AbstractWatcherIntegrationTestCase.java | 3 +- 61 files changed, 221 insertions(+), 79 deletions(-) delete mode 100644 modules/transport-netty4/licenses/netty-buffer-4.1.16.Final.jar.sha1 create mode 100644 modules/transport-netty4/licenses/netty-buffer-4.1.25.Final.jar.sha1 delete mode 100644 modules/transport-netty4/licenses/netty-codec-4.1.16.Final.jar.sha1 create mode 100644 modules/transport-netty4/licenses/netty-codec-4.1.25.Final.jar.sha1 delete mode 100644 modules/transport-netty4/licenses/netty-codec-http-4.1.16.Final.jar.sha1 create mode 100644 modules/transport-netty4/licenses/netty-codec-http-4.1.25.Final.jar.sha1 delete mode 100644 modules/transport-netty4/licenses/netty-common-4.1.16.Final.jar.sha1 create mode 100644 modules/transport-netty4/licenses/netty-common-4.1.25.Final.jar.sha1 delete mode 100644 modules/transport-netty4/licenses/netty-handler-4.1.16.Final.jar.sha1 create mode 100644 modules/transport-netty4/licenses/netty-handler-4.1.25.Final.jar.sha1 delete mode 100644 modules/transport-netty4/licenses/netty-resolver-4.1.16.Final.jar.sha1 create mode 100644 modules/transport-netty4/licenses/netty-resolver-4.1.25.Final.jar.sha1 delete mode 100644 modules/transport-netty4/licenses/netty-transport-4.1.16.Final.jar.sha1 create mode 100644 modules/transport-netty4/licenses/netty-transport-4.1.25.Final.jar.sha1 rename modules/transport-netty4/src/test/java/org/elasticsearch/{ESNetty4IntegTestCase.java => test/Netty4IntegTestCase.java} (90%) create mode 100644 modules/transport-netty4/src/test/java/org/elasticsearch/test/Netty4TestCase.java create mode 100644 modules/transport-netty4/src/test/java/org/elasticsearch/test/ObjectCleanerThreadThreadFilter.java delete mode 100644 plugins/transport-nio/licenses/netty-buffer-4.1.16.Final.jar.sha1 create mode 100644 plugins/transport-nio/licenses/netty-buffer-4.1.25.Final.jar.sha1 delete mode 100644 plugins/transport-nio/licenses/netty-codec-4.1.16.Final.jar.sha1 create mode 100644 plugins/transport-nio/licenses/netty-codec-4.1.25.Final.jar.sha1 delete mode 100644 plugins/transport-nio/licenses/netty-codec-http-4.1.16.Final.jar.sha1 create mode 100644 plugins/transport-nio/licenses/netty-codec-http-4.1.25.Final.jar.sha1 delete mode 100644 plugins/transport-nio/licenses/netty-common-4.1.16.Final.jar.sha1 create mode 100644 plugins/transport-nio/licenses/netty-common-4.1.25.Final.jar.sha1 delete mode 100644 plugins/transport-nio/licenses/netty-handler-4.1.16.Final.jar.sha1 create mode 100644 plugins/transport-nio/licenses/netty-handler-4.1.25.Final.jar.sha1 delete mode 100644 plugins/transport-nio/licenses/netty-resolver-4.1.16.Final.jar.sha1 create mode 100644 plugins/transport-nio/licenses/netty-resolver-4.1.25.Final.jar.sha1 delete mode 100644 plugins/transport-nio/licenses/netty-transport-4.1.16.Final.jar.sha1 create mode 100644 plugins/transport-nio/licenses/netty-transport-4.1.25.Final.jar.sha1 create mode 100644 x-pack/plugin/core/src/test/java/org/elasticsearch/test/ObjectCleanerThreadThreadFilter.java create mode 100644 x-pack/plugin/core/src/test/java/org/elasticsearch/test/XPackIntegTestCase.java create mode 100644 x-pack/plugin/core/src/test/java/org/elasticsearch/test/XPackSingleNodeTestCase.java diff --git a/modules/transport-netty4/build.gradle b/modules/transport-netty4/build.gradle index 5d4bcd7c10a84..ed905a530c48e 100644 --- a/modules/transport-netty4/build.gradle +++ b/modules/transport-netty4/build.gradle @@ -34,13 +34,13 @@ compileTestJava.options.compilerArgs << "-Xlint:-cast,-deprecation,-rawtypes,-tr dependencies { // network stack - compile "io.netty:netty-buffer:4.1.16.Final" - compile "io.netty:netty-codec:4.1.16.Final" - compile "io.netty:netty-codec-http:4.1.16.Final" - compile "io.netty:netty-common:4.1.16.Final" - compile "io.netty:netty-handler:4.1.16.Final" - compile "io.netty:netty-resolver:4.1.16.Final" - compile "io.netty:netty-transport:4.1.16.Final" + compile "io.netty:netty-buffer:4.1.25.Final" + compile "io.netty:netty-codec:4.1.25.Final" + compile "io.netty:netty-codec-http:4.1.25.Final" + compile "io.netty:netty-common:4.1.25.Final" + compile "io.netty:netty-handler:4.1.25.Final" + compile "io.netty:netty-resolver:4.1.25.Final" + compile "io.netty:netty-transport:4.1.25.Final" } dependencyLicenses { @@ -161,6 +161,6 @@ thirdPartyAudit.excludes = [ 'org.conscrypt.AllocatedBuffer', 'org.conscrypt.BufferAllocator', - 'org.conscrypt.Conscrypt$Engines', + 'org.conscrypt.Conscrypt', 'org.conscrypt.HandshakeListener' ] diff --git a/modules/transport-netty4/licenses/netty-buffer-4.1.16.Final.jar.sha1 b/modules/transport-netty4/licenses/netty-buffer-4.1.16.Final.jar.sha1 deleted file mode 100644 index c546222971985..0000000000000 --- a/modules/transport-netty4/licenses/netty-buffer-4.1.16.Final.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -63b5fa95c74785e16f2c30ce268bc222e35c8cb5 \ No newline at end of file diff --git a/modules/transport-netty4/licenses/netty-buffer-4.1.25.Final.jar.sha1 b/modules/transport-netty4/licenses/netty-buffer-4.1.25.Final.jar.sha1 new file mode 100644 index 0000000000000..3ca0cbb45ec31 --- /dev/null +++ b/modules/transport-netty4/licenses/netty-buffer-4.1.25.Final.jar.sha1 @@ -0,0 +1 @@ +f366d0cc87b158ca064d27507127e3cc4eb2f089 \ No newline at end of file diff --git a/modules/transport-netty4/licenses/netty-codec-4.1.16.Final.jar.sha1 b/modules/transport-netty4/licenses/netty-codec-4.1.16.Final.jar.sha1 deleted file mode 100644 index 1e6c241ea0b17..0000000000000 --- a/modules/transport-netty4/licenses/netty-codec-4.1.16.Final.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -d84a1f21768b7309c2954521cf5a1f46c2309eb1 \ No newline at end of file diff --git a/modules/transport-netty4/licenses/netty-codec-4.1.25.Final.jar.sha1 b/modules/transport-netty4/licenses/netty-codec-4.1.25.Final.jar.sha1 new file mode 100644 index 0000000000000..5e2bc85c548dd --- /dev/null +++ b/modules/transport-netty4/licenses/netty-codec-4.1.25.Final.jar.sha1 @@ -0,0 +1 @@ +3e465c75bead40d06b5b9c0612b37cf77c548887 \ No newline at end of file diff --git a/modules/transport-netty4/licenses/netty-codec-http-4.1.16.Final.jar.sha1 b/modules/transport-netty4/licenses/netty-codec-http-4.1.16.Final.jar.sha1 deleted file mode 100644 index 71c33af1c5fc2..0000000000000 --- a/modules/transport-netty4/licenses/netty-codec-http-4.1.16.Final.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -d64312378b438dfdad84267c599a053327c6f02a \ No newline at end of file diff --git a/modules/transport-netty4/licenses/netty-codec-http-4.1.25.Final.jar.sha1 b/modules/transport-netty4/licenses/netty-codec-http-4.1.25.Final.jar.sha1 new file mode 100644 index 0000000000000..58cb7fd987949 --- /dev/null +++ b/modules/transport-netty4/licenses/netty-codec-http-4.1.25.Final.jar.sha1 @@ -0,0 +1 @@ +70888d3f2a829541378f68503ddd52c3193df35a \ No newline at end of file diff --git a/modules/transport-netty4/licenses/netty-common-4.1.16.Final.jar.sha1 b/modules/transport-netty4/licenses/netty-common-4.1.16.Final.jar.sha1 deleted file mode 100644 index 3edf5fcea59b3..0000000000000 --- a/modules/transport-netty4/licenses/netty-common-4.1.16.Final.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -177a6b30cca92f6f5f9873c9befd681377a4c328 \ No newline at end of file diff --git a/modules/transport-netty4/licenses/netty-common-4.1.25.Final.jar.sha1 b/modules/transport-netty4/licenses/netty-common-4.1.25.Final.jar.sha1 new file mode 100644 index 0000000000000..62f85f8965513 --- /dev/null +++ b/modules/transport-netty4/licenses/netty-common-4.1.25.Final.jar.sha1 @@ -0,0 +1 @@ +e17d5c05c101fe14536ce3fb34b36c54e04791f6 \ No newline at end of file diff --git a/modules/transport-netty4/licenses/netty-handler-4.1.16.Final.jar.sha1 b/modules/transport-netty4/licenses/netty-handler-4.1.16.Final.jar.sha1 deleted file mode 100644 index cba27387268d1..0000000000000 --- a/modules/transport-netty4/licenses/netty-handler-4.1.16.Final.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -fec0e63e7dd7f4eeef7ea8dc47a1ff32dfc7ebc2 \ No newline at end of file diff --git a/modules/transport-netty4/licenses/netty-handler-4.1.25.Final.jar.sha1 b/modules/transport-netty4/licenses/netty-handler-4.1.25.Final.jar.sha1 new file mode 100644 index 0000000000000..5391f625a4df0 --- /dev/null +++ b/modules/transport-netty4/licenses/netty-handler-4.1.25.Final.jar.sha1 @@ -0,0 +1 @@ +ecdfb8fe93a8b75db3ea8746d3437eed845c24bd \ No newline at end of file diff --git a/modules/transport-netty4/licenses/netty-resolver-4.1.16.Final.jar.sha1 b/modules/transport-netty4/licenses/netty-resolver-4.1.16.Final.jar.sha1 deleted file mode 100644 index 3571d2ecfdc48..0000000000000 --- a/modules/transport-netty4/licenses/netty-resolver-4.1.16.Final.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -f6eb553b53fb3a90a8ac1170697093fed82eae28 \ No newline at end of file diff --git a/modules/transport-netty4/licenses/netty-resolver-4.1.25.Final.jar.sha1 b/modules/transport-netty4/licenses/netty-resolver-4.1.25.Final.jar.sha1 new file mode 100644 index 0000000000000..8225fb799e3ff --- /dev/null +++ b/modules/transport-netty4/licenses/netty-resolver-4.1.25.Final.jar.sha1 @@ -0,0 +1 @@ +dc0965d00746b782b33f419b005cbc130973030d \ No newline at end of file diff --git a/modules/transport-netty4/licenses/netty-transport-4.1.16.Final.jar.sha1 b/modules/transport-netty4/licenses/netty-transport-4.1.16.Final.jar.sha1 deleted file mode 100644 index e502d4c77084c..0000000000000 --- a/modules/transport-netty4/licenses/netty-transport-4.1.16.Final.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -3c8ee2c4d4a1cbb947a5c184c7aeb2204260958b \ No newline at end of file diff --git a/modules/transport-netty4/licenses/netty-transport-4.1.25.Final.jar.sha1 b/modules/transport-netty4/licenses/netty-transport-4.1.25.Final.jar.sha1 new file mode 100644 index 0000000000000..1049ea4b98bc6 --- /dev/null +++ b/modules/transport-netty4/licenses/netty-transport-4.1.25.Final.jar.sha1 @@ -0,0 +1 @@ +19a6f1f649894b6705aa9d8cbcced188dff133b0 \ No newline at end of file diff --git a/modules/transport-netty4/src/main/plugin-metadata/plugin-security.policy b/modules/transport-netty4/src/main/plugin-metadata/plugin-security.policy index 32b2dc9bd1540..3775931efb150 100644 --- a/modules/transport-netty4/src/main/plugin-metadata/plugin-security.policy +++ b/modules/transport-netty4/src/main/plugin-metadata/plugin-security.policy @@ -21,6 +21,8 @@ grant codeBase "${codebase.netty-common}" { // for reading the system-wide configuration for the backlog of established sockets permission java.io.FilePermission "/proc/sys/net/core/somaxconn", "read"; + permission java.lang.RuntimePermission "setContextClassLoader"; + // netty makes and accepts socket connections permission java.net.SocketPermission "*", "accept,connect"; }; diff --git a/modules/transport-netty4/src/test/java/org/elasticsearch/http/netty4/Netty4BadRequestTests.java b/modules/transport-netty4/src/test/java/org/elasticsearch/http/netty4/Netty4BadRequestTests.java index 094f339059876..8baf818975ed8 100644 --- a/modules/transport-netty4/src/test/java/org/elasticsearch/http/netty4/Netty4BadRequestTests.java +++ b/modules/transport-netty4/src/test/java/org/elasticsearch/http/netty4/Netty4BadRequestTests.java @@ -20,6 +20,7 @@ package org.elasticsearch.http.netty4; import io.netty.handler.codec.http.FullHttpResponse; +import org.elasticsearch.test.Netty4TestCase; import org.elasticsearch.ElasticsearchException; import org.elasticsearch.common.network.NetworkService; import org.elasticsearch.common.settings.Settings; @@ -33,7 +34,6 @@ import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.RestStatus; -import org.elasticsearch.test.ESTestCase; import org.elasticsearch.threadpool.TestThreadPool; import org.elasticsearch.threadpool.ThreadPool; import org.junit.After; @@ -48,7 +48,7 @@ import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.hasSize; -public class Netty4BadRequestTests extends ESTestCase { +public class Netty4BadRequestTests extends Netty4TestCase { private NetworkService networkService; private MockBigArrays bigArrays; diff --git a/modules/transport-netty4/src/test/java/org/elasticsearch/http/netty4/Netty4HttpChannelTests.java b/modules/transport-netty4/src/test/java/org/elasticsearch/http/netty4/Netty4HttpChannelTests.java index 7c5b35a322996..f7f04cfa540f6 100644 --- a/modules/transport-netty4/src/test/java/org/elasticsearch/http/netty4/Netty4HttpChannelTests.java +++ b/modules/transport-netty4/src/test/java/org/elasticsearch/http/netty4/Netty4HttpChannelTests.java @@ -41,6 +41,7 @@ import io.netty.handler.codec.http.HttpVersion; import io.netty.util.Attribute; import io.netty.util.AttributeKey; +import org.elasticsearch.test.Netty4TestCase; import org.elasticsearch.common.bytes.BytesReference; import org.elasticsearch.common.bytes.ReleasablePagedBytesReference; import org.elasticsearch.common.io.stream.BytesStreamOutput; @@ -64,7 +65,6 @@ import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; -import org.elasticsearch.test.ESTestCase; import org.elasticsearch.threadpool.TestThreadPool; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.netty4.Netty4Utils; @@ -90,7 +90,7 @@ import static org.hamcrest.Matchers.notNullValue; import static org.hamcrest.Matchers.nullValue; -public class Netty4HttpChannelTests extends ESTestCase { +public class Netty4HttpChannelTests extends Netty4TestCase { private NetworkService networkService; private ThreadPool threadPool; diff --git a/modules/transport-netty4/src/test/java/org/elasticsearch/http/netty4/Netty4HttpPipeliningHandlerTests.java b/modules/transport-netty4/src/test/java/org/elasticsearch/http/netty4/Netty4HttpPipeliningHandlerTests.java index 21151304424c1..606b050f4e393 100644 --- a/modules/transport-netty4/src/test/java/org/elasticsearch/http/netty4/Netty4HttpPipeliningHandlerTests.java +++ b/modules/transport-netty4/src/test/java/org/elasticsearch/http/netty4/Netty4HttpPipeliningHandlerTests.java @@ -36,9 +36,9 @@ import io.netty.handler.codec.http.HttpVersion; import io.netty.handler.codec.http.LastHttpContent; import io.netty.handler.codec.http.QueryStringDecoder; +import org.elasticsearch.test.Netty4TestCase; import org.elasticsearch.common.Randomness; import org.elasticsearch.http.HttpPipelinedRequest; -import org.elasticsearch.test.ESTestCase; import org.junit.After; import java.nio.channels.ClosedChannelException; @@ -61,7 +61,7 @@ import static io.netty.handler.codec.http.HttpVersion.HTTP_1_1; import static org.hamcrest.core.Is.is; -public class Netty4HttpPipeliningHandlerTests extends ESTestCase { +public class Netty4HttpPipeliningHandlerTests extends Netty4TestCase { private final ExecutorService handlerService = Executors.newFixedThreadPool(randomIntBetween(4, 8)); private final ExecutorService eventLoopService = Executors.newFixedThreadPool(1); diff --git a/modules/transport-netty4/src/test/java/org/elasticsearch/http/netty4/Netty4HttpRequestSizeLimitIT.java b/modules/transport-netty4/src/test/java/org/elasticsearch/http/netty4/Netty4HttpRequestSizeLimitIT.java index e8d6d30b02bfa..ec3dbbf3846f0 100644 --- a/modules/transport-netty4/src/test/java/org/elasticsearch/http/netty4/Netty4HttpRequestSizeLimitIT.java +++ b/modules/transport-netty4/src/test/java/org/elasticsearch/http/netty4/Netty4HttpRequestSizeLimitIT.java @@ -20,9 +20,8 @@ package org.elasticsearch.http.netty4; import io.netty.handler.codec.http.FullHttpResponse; -import org.elasticsearch.ESNetty4IntegTestCase; +import org.elasticsearch.test.Netty4IntegTestCase; import org.elasticsearch.common.collect.Tuple; -import org.elasticsearch.common.network.NetworkModule; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.transport.TransportAddress; import org.elasticsearch.common.unit.ByteSizeUnit; @@ -46,7 +45,7 @@ * a single node "cluster". We also force test infrastructure to use the node client instead of the transport client for the same reason. */ @ClusterScope(scope = Scope.TEST, supportsDedicatedMasters = false, numClientNodes = 0, numDataNodes = 1, transportClientRatio = 0) -public class Netty4HttpRequestSizeLimitIT extends ESNetty4IntegTestCase { +public class Netty4HttpRequestSizeLimitIT extends Netty4IntegTestCase { private static final ByteSizeValue LIMIT = new ByteSizeValue(2, ByteSizeUnit.KB); diff --git a/modules/transport-netty4/src/test/java/org/elasticsearch/http/netty4/Netty4HttpServerPipeliningTests.java b/modules/transport-netty4/src/test/java/org/elasticsearch/http/netty4/Netty4HttpServerPipeliningTests.java index f2b28b909187b..68b51f8acc13f 100644 --- a/modules/transport-netty4/src/test/java/org/elasticsearch/http/netty4/Netty4HttpServerPipeliningTests.java +++ b/modules/transport-netty4/src/test/java/org/elasticsearch/http/netty4/Netty4HttpServerPipeliningTests.java @@ -32,6 +32,7 @@ import io.netty.handler.codec.http.HttpHeaderNames; import io.netty.handler.codec.http.HttpResponseStatus; import io.netty.handler.codec.http.HttpVersion; +import org.elasticsearch.test.Netty4TestCase; import org.elasticsearch.common.network.NetworkService; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.transport.TransportAddress; @@ -42,7 +43,6 @@ import org.elasticsearch.http.HttpServerTransport; import org.elasticsearch.http.NullDispatcher; import org.elasticsearch.indices.breaker.NoneCircuitBreakerService; -import org.elasticsearch.test.ESTestCase; import org.elasticsearch.threadpool.TestThreadPool; import org.elasticsearch.threadpool.ThreadPool; import org.junit.After; @@ -61,7 +61,7 @@ /** * This test just tests, if he pipelining works in general with out any connection the Elasticsearch handler */ -public class Netty4HttpServerPipeliningTests extends ESTestCase { +public class Netty4HttpServerPipeliningTests extends Netty4TestCase { private NetworkService networkService; private ThreadPool threadPool; private MockBigArrays bigArrays; diff --git a/modules/transport-netty4/src/test/java/org/elasticsearch/http/netty4/Netty4HttpServerTransportTests.java b/modules/transport-netty4/src/test/java/org/elasticsearch/http/netty4/Netty4HttpServerTransportTests.java index 5b22409b92da0..1df18459a0352 100644 --- a/modules/transport-netty4/src/test/java/org/elasticsearch/http/netty4/Netty4HttpServerTransportTests.java +++ b/modules/transport-netty4/src/test/java/org/elasticsearch/http/netty4/Netty4HttpServerTransportTests.java @@ -38,6 +38,7 @@ import io.netty.handler.codec.http.HttpResponseStatus; import io.netty.handler.codec.http.HttpUtil; import io.netty.handler.codec.http.HttpVersion; +import org.elasticsearch.test.Netty4TestCase; import org.elasticsearch.ElasticsearchException; import org.elasticsearch.common.Strings; import org.elasticsearch.common.bytes.BytesArray; @@ -59,7 +60,6 @@ import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.test.ESTestCase; import org.elasticsearch.threadpool.TestThreadPool; import org.elasticsearch.threadpool.ThreadPool; import org.junit.After; @@ -94,7 +94,7 @@ /** * Tests for the {@link Netty4HttpServerTransport} class. */ -public class Netty4HttpServerTransportTests extends ESTestCase { +public class Netty4HttpServerTransportTests extends Netty4TestCase { private NetworkService networkService; private ThreadPool threadPool; diff --git a/modules/transport-netty4/src/test/java/org/elasticsearch/http/netty4/Netty4PipeliningIT.java b/modules/transport-netty4/src/test/java/org/elasticsearch/http/netty4/Netty4PipeliningIT.java index ebb91d9663ed5..c90992a69d0b3 100644 --- a/modules/transport-netty4/src/test/java/org/elasticsearch/http/netty4/Netty4PipeliningIT.java +++ b/modules/transport-netty4/src/test/java/org/elasticsearch/http/netty4/Netty4PipeliningIT.java @@ -20,7 +20,7 @@ package org.elasticsearch.http.netty4; import io.netty.handler.codec.http.FullHttpResponse; -import org.elasticsearch.ESNetty4IntegTestCase; +import org.elasticsearch.test.Netty4IntegTestCase; import org.elasticsearch.common.transport.TransportAddress; import org.elasticsearch.http.HttpServerTransport; import org.elasticsearch.test.ESIntegTestCase.ClusterScope; @@ -33,7 +33,7 @@ import static org.hamcrest.Matchers.is; @ClusterScope(scope = Scope.TEST, supportsDedicatedMasters = false, numDataNodes = 1) -public class Netty4PipeliningIT extends ESNetty4IntegTestCase { +public class Netty4PipeliningIT extends Netty4IntegTestCase { @Override protected boolean addMockHttpTransport() { diff --git a/modules/transport-netty4/src/test/java/org/elasticsearch/ESNetty4IntegTestCase.java b/modules/transport-netty4/src/test/java/org/elasticsearch/test/Netty4IntegTestCase.java similarity index 90% rename from modules/transport-netty4/src/test/java/org/elasticsearch/ESNetty4IntegTestCase.java rename to modules/transport-netty4/src/test/java/org/elasticsearch/test/Netty4IntegTestCase.java index b38cda76c6980..c21b863d196b7 100644 --- a/modules/transport-netty4/src/test/java/org/elasticsearch/ESNetty4IntegTestCase.java +++ b/modules/transport-netty4/src/test/java/org/elasticsearch/test/Netty4IntegTestCase.java @@ -16,19 +16,21 @@ * specific language governing permissions and limitations * under the License. */ -package org.elasticsearch; +package org.elasticsearch.test; + +import com.carrotsearch.randomizedtesting.annotations.ThreadLeakFilters; import org.elasticsearch.common.network.NetworkModule; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.plugins.Plugin; -import org.elasticsearch.test.ESIntegTestCase; import org.elasticsearch.transport.Netty4Plugin; import org.elasticsearch.transport.netty4.Netty4Transport; import java.util.Arrays; import java.util.Collection; -public abstract class ESNetty4IntegTestCase extends ESIntegTestCase { +@ThreadLeakFilters(filters = {ObjectCleanerThreadThreadFilter.class}) +public abstract class Netty4IntegTestCase extends ESIntegTestCase { @Override protected boolean ignoreExternalCluster() { diff --git a/modules/transport-netty4/src/test/java/org/elasticsearch/test/Netty4TestCase.java b/modules/transport-netty4/src/test/java/org/elasticsearch/test/Netty4TestCase.java new file mode 100644 index 0000000000000..df931d61992ef --- /dev/null +++ b/modules/transport-netty4/src/test/java/org/elasticsearch/test/Netty4TestCase.java @@ -0,0 +1,26 @@ +/* + * Licensed to Elasticsearch under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.elasticsearch.test; + +import com.carrotsearch.randomizedtesting.annotations.ThreadLeakFilters; + +@ThreadLeakFilters(filters = {ObjectCleanerThreadThreadFilter.class}) +public abstract class Netty4TestCase extends ESTestCase { +} diff --git a/modules/transport-netty4/src/test/java/org/elasticsearch/test/ObjectCleanerThreadThreadFilter.java b/modules/transport-netty4/src/test/java/org/elasticsearch/test/ObjectCleanerThreadThreadFilter.java new file mode 100644 index 0000000000000..7092f10394883 --- /dev/null +++ b/modules/transport-netty4/src/test/java/org/elasticsearch/test/ObjectCleanerThreadThreadFilter.java @@ -0,0 +1,37 @@ +/* + * Licensed to Elasticsearch under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.elasticsearch.test; + +import com.carrotsearch.randomizedtesting.ThreadFilter; + +/** + * The Netty object cleaner thread is not closeable and it does not terminate in a timely manner. This means that thread leak control in + * tests will fail test suites when the object cleaner thread has not terminated. Since there is not a reliable way to terminate this thread + * we instead filter it out of thread leak control. + */ +public class ObjectCleanerThreadThreadFilter implements ThreadFilter { + + @Override + public boolean reject(final Thread t) { + return "ObjectCleanerThread".equals(t.getName()); + } + +} + diff --git a/modules/transport-netty4/src/test/java/org/elasticsearch/transport/netty4/ByteBufBytesReferenceTests.java b/modules/transport-netty4/src/test/java/org/elasticsearch/transport/netty4/ByteBufBytesReferenceTests.java index 7a6768010eb16..618d3ffe8f96a 100644 --- a/modules/transport-netty4/src/test/java/org/elasticsearch/transport/netty4/ByteBufBytesReferenceTests.java +++ b/modules/transport-netty4/src/test/java/org/elasticsearch/transport/netty4/ByteBufBytesReferenceTests.java @@ -18,17 +18,18 @@ */ package org.elasticsearch.transport.netty4; +import com.carrotsearch.randomizedtesting.annotations.ThreadLeakFilters; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import org.apache.lucene.util.BytesRef; +import org.elasticsearch.test.ObjectCleanerThreadThreadFilter; import org.elasticsearch.common.bytes.AbstractBytesReferenceTestCase; import org.elasticsearch.common.bytes.BytesReference; import org.elasticsearch.common.io.stream.ReleasableBytesStreamOutput; -import javax.net.ssl.SSLEngine; import java.io.IOException; -import java.nio.ByteBuffer; +@ThreadLeakFilters(filters = {ObjectCleanerThreadThreadFilter.class}) public class ByteBufBytesReferenceTests extends AbstractBytesReferenceTestCase { @Override diff --git a/modules/transport-netty4/src/test/java/org/elasticsearch/transport/netty4/ESLoggingHandlerIT.java b/modules/transport-netty4/src/test/java/org/elasticsearch/transport/netty4/ESLoggingHandlerIT.java index acd71749e2333..8ef8b28dc1497 100644 --- a/modules/transport-netty4/src/test/java/org/elasticsearch/transport/netty4/ESLoggingHandlerIT.java +++ b/modules/transport-netty4/src/test/java/org/elasticsearch/transport/netty4/ESLoggingHandlerIT.java @@ -20,7 +20,7 @@ package org.elasticsearch.transport.netty4; import org.apache.logging.log4j.Level; -import org.elasticsearch.ESNetty4IntegTestCase; +import org.elasticsearch.test.Netty4IntegTestCase; import org.elasticsearch.action.admin.cluster.node.hotthreads.NodesHotThreadsRequest; import org.elasticsearch.common.logging.Loggers; import org.elasticsearch.test.ESIntegTestCase; @@ -29,7 +29,7 @@ @ESIntegTestCase.ClusterScope(numDataNodes = 2) @TestLogging(value = "org.elasticsearch.transport.netty4.ESLoggingHandler:trace") -public class ESLoggingHandlerIT extends ESNetty4IntegTestCase { +public class ESLoggingHandlerIT extends Netty4IntegTestCase { private MockLogAppender appender; diff --git a/modules/transport-netty4/src/test/java/org/elasticsearch/transport/netty4/Netty4ScheduledPingTests.java b/modules/transport-netty4/src/test/java/org/elasticsearch/transport/netty4/Netty4ScheduledPingTests.java index b967a7ea41069..b4b33ba96211c 100644 --- a/modules/transport-netty4/src/test/java/org/elasticsearch/transport/netty4/Netty4ScheduledPingTests.java +++ b/modules/transport-netty4/src/test/java/org/elasticsearch/transport/netty4/Netty4ScheduledPingTests.java @@ -18,6 +18,7 @@ */ package org.elasticsearch.transport.netty4; +import org.elasticsearch.test.Netty4TestCase; import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.common.io.stream.NamedWriteableRegistry; import org.elasticsearch.common.lease.Releasables; @@ -26,7 +27,6 @@ import org.elasticsearch.common.util.BigArrays; import org.elasticsearch.indices.breaker.CircuitBreakerService; import org.elasticsearch.indices.breaker.NoneCircuitBreakerService; -import org.elasticsearch.test.ESTestCase; import org.elasticsearch.test.transport.MockTransportService; import org.elasticsearch.threadpool.TestThreadPool; import org.elasticsearch.threadpool.ThreadPool; @@ -47,7 +47,7 @@ import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.greaterThan; -public class Netty4ScheduledPingTests extends ESTestCase { +public class Netty4ScheduledPingTests extends Netty4TestCase { public void testScheduledPing() throws Exception { ThreadPool threadPool = new TestThreadPool(getClass().getName()); diff --git a/modules/transport-netty4/src/test/java/org/elasticsearch/transport/netty4/Netty4SizeHeaderFrameDecoderTests.java b/modules/transport-netty4/src/test/java/org/elasticsearch/transport/netty4/Netty4SizeHeaderFrameDecoderTests.java index 7343da6c3b11a..0819548907296 100644 --- a/modules/transport-netty4/src/test/java/org/elasticsearch/transport/netty4/Netty4SizeHeaderFrameDecoderTests.java +++ b/modules/transport-netty4/src/test/java/org/elasticsearch/transport/netty4/Netty4SizeHeaderFrameDecoderTests.java @@ -19,6 +19,7 @@ package org.elasticsearch.transport.netty4; +import org.elasticsearch.test.Netty4TestCase; import org.elasticsearch.common.io.stream.NamedWriteableRegistry; import org.elasticsearch.common.network.NetworkService; import org.elasticsearch.common.settings.Settings; @@ -28,7 +29,6 @@ import org.elasticsearch.common.util.MockPageCacheRecycler; import org.elasticsearch.indices.breaker.NoneCircuitBreakerService; import org.elasticsearch.mocksocket.MockSocket; -import org.elasticsearch.test.ESTestCase; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.TcpTransport; import org.junit.After; @@ -47,7 +47,7 @@ * This test checks, if a HTTP look-alike request (starting with a HTTP method and a space) * actually returns text response instead of just dropping the connection */ -public class Netty4SizeHeaderFrameDecoderTests extends ESTestCase { +public class Netty4SizeHeaderFrameDecoderTests extends Netty4TestCase { private final Settings settings = Settings.builder() .put("node.name", "NettySizeHeaderFrameDecoderTests") diff --git a/modules/transport-netty4/src/test/java/org/elasticsearch/transport/netty4/Netty4TransportIT.java b/modules/transport-netty4/src/test/java/org/elasticsearch/transport/netty4/Netty4TransportIT.java index b81c8efcb47ee..a426c11db8245 100644 --- a/modules/transport-netty4/src/test/java/org/elasticsearch/transport/netty4/Netty4TransportIT.java +++ b/modules/transport-netty4/src/test/java/org/elasticsearch/transport/netty4/Netty4TransportIT.java @@ -18,7 +18,7 @@ */ package org.elasticsearch.transport.netty4; -import org.elasticsearch.ESNetty4IntegTestCase; +import org.elasticsearch.test.Netty4IntegTestCase; import org.elasticsearch.ElasticsearchException; import org.elasticsearch.Version; import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse; @@ -54,7 +54,7 @@ import static org.hamcrest.Matchers.is; @ClusterScope(scope = Scope.TEST, supportsDedicatedMasters = false, numDataNodes = 1) -public class Netty4TransportIT extends ESNetty4IntegTestCase { +public class Netty4TransportIT extends Netty4IntegTestCase { // static so we can use it in anonymous classes private static String channelProfileName = null; diff --git a/modules/transport-netty4/src/test/java/org/elasticsearch/transport/netty4/Netty4TransportMultiPortIntegrationIT.java b/modules/transport-netty4/src/test/java/org/elasticsearch/transport/netty4/Netty4TransportMultiPortIntegrationIT.java index 52ad32efb5645..ddef8abcf0181 100644 --- a/modules/transport-netty4/src/test/java/org/elasticsearch/transport/netty4/Netty4TransportMultiPortIntegrationIT.java +++ b/modules/transport-netty4/src/test/java/org/elasticsearch/transport/netty4/Netty4TransportMultiPortIntegrationIT.java @@ -18,7 +18,7 @@ */ package org.elasticsearch.transport.netty4; -import org.elasticsearch.ESNetty4IntegTestCase; +import org.elasticsearch.test.Netty4IntegTestCase; import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse; import org.elasticsearch.action.admin.cluster.node.info.NodeInfo; import org.elasticsearch.action.admin.cluster.node.info.NodesInfoResponse; @@ -48,7 +48,7 @@ import static org.hamcrest.Matchers.lessThanOrEqualTo; @ClusterScope(scope = Scope.SUITE, supportsDedicatedMasters = false, numDataNodes = 1, numClientNodes = 0) -public class Netty4TransportMultiPortIntegrationIT extends ESNetty4IntegTestCase { +public class Netty4TransportMultiPortIntegrationIT extends Netty4IntegTestCase { private static int randomPort = -1; private static String randomPortRange; diff --git a/modules/transport-netty4/src/test/java/org/elasticsearch/transport/netty4/Netty4TransportPublishAddressIT.java b/modules/transport-netty4/src/test/java/org/elasticsearch/transport/netty4/Netty4TransportPublishAddressIT.java index 922031d3c3dea..dee104a73f7d7 100644 --- a/modules/transport-netty4/src/test/java/org/elasticsearch/transport/netty4/Netty4TransportPublishAddressIT.java +++ b/modules/transport-netty4/src/test/java/org/elasticsearch/transport/netty4/Netty4TransportPublishAddressIT.java @@ -19,7 +19,7 @@ package org.elasticsearch.transport.netty4; -import org.elasticsearch.ESNetty4IntegTestCase; +import org.elasticsearch.test.Netty4IntegTestCase; import org.elasticsearch.action.admin.cluster.node.info.NodeInfo; import org.elasticsearch.action.admin.cluster.node.info.NodesInfoResponse; import org.elasticsearch.common.network.NetworkModule; @@ -41,7 +41,7 @@ * different ports on ipv4 and ipv6. */ @ESIntegTestCase.ClusterScope(scope = ESIntegTestCase.Scope.TEST, numDataNodes = 0) -public class Netty4TransportPublishAddressIT extends ESNetty4IntegTestCase { +public class Netty4TransportPublishAddressIT extends Netty4IntegTestCase { @Override protected Settings nodeSettings(int nodeOrdinal) { return Settings.builder() diff --git a/modules/transport-netty4/src/test/java/org/elasticsearch/transport/netty4/NettyTransportMultiPortTests.java b/modules/transport-netty4/src/test/java/org/elasticsearch/transport/netty4/NettyTransportMultiPortTests.java index a49df3caaba4e..05d6d55ac42da 100644 --- a/modules/transport-netty4/src/test/java/org/elasticsearch/transport/netty4/NettyTransportMultiPortTests.java +++ b/modules/transport-netty4/src/test/java/org/elasticsearch/transport/netty4/NettyTransportMultiPortTests.java @@ -18,6 +18,7 @@ */ package org.elasticsearch.transport.netty4; +import org.elasticsearch.test.Netty4TestCase; import org.elasticsearch.common.component.Lifecycle; import org.elasticsearch.common.io.stream.NamedWriteableRegistry; import org.elasticsearch.common.network.NetworkService; @@ -27,7 +28,6 @@ import org.elasticsearch.common.util.MockBigArrays; import org.elasticsearch.common.util.MockPageCacheRecycler; import org.elasticsearch.indices.breaker.NoneCircuitBreakerService; -import org.elasticsearch.test.ESTestCase; import org.elasticsearch.threadpool.TestThreadPool; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.TcpTransport; @@ -37,7 +37,7 @@ import static org.hamcrest.Matchers.is; -public class NettyTransportMultiPortTests extends ESTestCase { +public class NettyTransportMultiPortTests extends Netty4TestCase { private String host; diff --git a/modules/transport-netty4/src/test/java/org/elasticsearch/transport/netty4/SimpleNetty4TransportTests.java b/modules/transport-netty4/src/test/java/org/elasticsearch/transport/netty4/SimpleNetty4TransportTests.java index efa296b6278af..278b00965c9a5 100644 --- a/modules/transport-netty4/src/test/java/org/elasticsearch/transport/netty4/SimpleNetty4TransportTests.java +++ b/modules/transport-netty4/src/test/java/org/elasticsearch/transport/netty4/SimpleNetty4TransportTests.java @@ -19,6 +19,8 @@ package org.elasticsearch.transport.netty4; +import com.carrotsearch.randomizedtesting.annotations.ThreadLeakFilters; +import org.elasticsearch.test.ObjectCleanerThreadThreadFilter; import org.elasticsearch.Version; import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.common.io.stream.NamedWriteableRegistry; @@ -49,6 +51,7 @@ import static java.util.Collections.emptySet; import static org.hamcrest.Matchers.containsString; +@ThreadLeakFilters(filters = {ObjectCleanerThreadThreadFilter.class}) public class SimpleNetty4TransportTests extends AbstractSimpleTransportTestCase { public static MockTransportService nettyFromThreadPool(Settings settings, ThreadPool threadPool, final Version version, diff --git a/plugins/transport-nio/build.gradle b/plugins/transport-nio/build.gradle index 856a8552b8e5a..e76008ae28400 100644 --- a/plugins/transport-nio/build.gradle +++ b/plugins/transport-nio/build.gradle @@ -29,13 +29,13 @@ dependencies { compile "org.elasticsearch:elasticsearch-nio:${version}" // network stack - compile "io.netty:netty-buffer:4.1.16.Final" - compile "io.netty:netty-codec:4.1.16.Final" - compile "io.netty:netty-codec-http:4.1.16.Final" - compile "io.netty:netty-common:4.1.16.Final" - compile "io.netty:netty-handler:4.1.16.Final" - compile "io.netty:netty-resolver:4.1.16.Final" - compile "io.netty:netty-transport:4.1.16.Final" + compile "io.netty:netty-buffer:4.1.25.Final" + compile "io.netty:netty-codec:4.1.25.Final" + compile "io.netty:netty-codec-http:4.1.25.Final" + compile "io.netty:netty-common:4.1.25.Final" + compile "io.netty:netty-handler:4.1.25.Final" + compile "io.netty:netty-resolver:4.1.25.Final" + compile "io.netty:netty-transport:4.1.25.Final" } dependencyLicenses { @@ -140,6 +140,6 @@ thirdPartyAudit.excludes = [ 'org.conscrypt.AllocatedBuffer', 'org.conscrypt.BufferAllocator', - 'org.conscrypt.Conscrypt$Engines', + 'org.conscrypt.Conscrypt', 'org.conscrypt.HandshakeListener' ] \ No newline at end of file diff --git a/plugins/transport-nio/licenses/netty-buffer-4.1.16.Final.jar.sha1 b/plugins/transport-nio/licenses/netty-buffer-4.1.16.Final.jar.sha1 deleted file mode 100644 index c546222971985..0000000000000 --- a/plugins/transport-nio/licenses/netty-buffer-4.1.16.Final.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -63b5fa95c74785e16f2c30ce268bc222e35c8cb5 \ No newline at end of file diff --git a/plugins/transport-nio/licenses/netty-buffer-4.1.25.Final.jar.sha1 b/plugins/transport-nio/licenses/netty-buffer-4.1.25.Final.jar.sha1 new file mode 100644 index 0000000000000..3ca0cbb45ec31 --- /dev/null +++ b/plugins/transport-nio/licenses/netty-buffer-4.1.25.Final.jar.sha1 @@ -0,0 +1 @@ +f366d0cc87b158ca064d27507127e3cc4eb2f089 \ No newline at end of file diff --git a/plugins/transport-nio/licenses/netty-codec-4.1.16.Final.jar.sha1 b/plugins/transport-nio/licenses/netty-codec-4.1.16.Final.jar.sha1 deleted file mode 100644 index 1e6c241ea0b17..0000000000000 --- a/plugins/transport-nio/licenses/netty-codec-4.1.16.Final.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -d84a1f21768b7309c2954521cf5a1f46c2309eb1 \ No newline at end of file diff --git a/plugins/transport-nio/licenses/netty-codec-4.1.25.Final.jar.sha1 b/plugins/transport-nio/licenses/netty-codec-4.1.25.Final.jar.sha1 new file mode 100644 index 0000000000000..5e2bc85c548dd --- /dev/null +++ b/plugins/transport-nio/licenses/netty-codec-4.1.25.Final.jar.sha1 @@ -0,0 +1 @@ +3e465c75bead40d06b5b9c0612b37cf77c548887 \ No newline at end of file diff --git a/plugins/transport-nio/licenses/netty-codec-http-4.1.16.Final.jar.sha1 b/plugins/transport-nio/licenses/netty-codec-http-4.1.16.Final.jar.sha1 deleted file mode 100644 index 71c33af1c5fc2..0000000000000 --- a/plugins/transport-nio/licenses/netty-codec-http-4.1.16.Final.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -d64312378b438dfdad84267c599a053327c6f02a \ No newline at end of file diff --git a/plugins/transport-nio/licenses/netty-codec-http-4.1.25.Final.jar.sha1 b/plugins/transport-nio/licenses/netty-codec-http-4.1.25.Final.jar.sha1 new file mode 100644 index 0000000000000..58cb7fd987949 --- /dev/null +++ b/plugins/transport-nio/licenses/netty-codec-http-4.1.25.Final.jar.sha1 @@ -0,0 +1 @@ +70888d3f2a829541378f68503ddd52c3193df35a \ No newline at end of file diff --git a/plugins/transport-nio/licenses/netty-common-4.1.16.Final.jar.sha1 b/plugins/transport-nio/licenses/netty-common-4.1.16.Final.jar.sha1 deleted file mode 100644 index 3edf5fcea59b3..0000000000000 --- a/plugins/transport-nio/licenses/netty-common-4.1.16.Final.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -177a6b30cca92f6f5f9873c9befd681377a4c328 \ No newline at end of file diff --git a/plugins/transport-nio/licenses/netty-common-4.1.25.Final.jar.sha1 b/plugins/transport-nio/licenses/netty-common-4.1.25.Final.jar.sha1 new file mode 100644 index 0000000000000..62f85f8965513 --- /dev/null +++ b/plugins/transport-nio/licenses/netty-common-4.1.25.Final.jar.sha1 @@ -0,0 +1 @@ +e17d5c05c101fe14536ce3fb34b36c54e04791f6 \ No newline at end of file diff --git a/plugins/transport-nio/licenses/netty-handler-4.1.16.Final.jar.sha1 b/plugins/transport-nio/licenses/netty-handler-4.1.16.Final.jar.sha1 deleted file mode 100644 index cba27387268d1..0000000000000 --- a/plugins/transport-nio/licenses/netty-handler-4.1.16.Final.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -fec0e63e7dd7f4eeef7ea8dc47a1ff32dfc7ebc2 \ No newline at end of file diff --git a/plugins/transport-nio/licenses/netty-handler-4.1.25.Final.jar.sha1 b/plugins/transport-nio/licenses/netty-handler-4.1.25.Final.jar.sha1 new file mode 100644 index 0000000000000..5391f625a4df0 --- /dev/null +++ b/plugins/transport-nio/licenses/netty-handler-4.1.25.Final.jar.sha1 @@ -0,0 +1 @@ +ecdfb8fe93a8b75db3ea8746d3437eed845c24bd \ No newline at end of file diff --git a/plugins/transport-nio/licenses/netty-resolver-4.1.16.Final.jar.sha1 b/plugins/transport-nio/licenses/netty-resolver-4.1.16.Final.jar.sha1 deleted file mode 100644 index 3571d2ecfdc48..0000000000000 --- a/plugins/transport-nio/licenses/netty-resolver-4.1.16.Final.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -f6eb553b53fb3a90a8ac1170697093fed82eae28 \ No newline at end of file diff --git a/plugins/transport-nio/licenses/netty-resolver-4.1.25.Final.jar.sha1 b/plugins/transport-nio/licenses/netty-resolver-4.1.25.Final.jar.sha1 new file mode 100644 index 0000000000000..8225fb799e3ff --- /dev/null +++ b/plugins/transport-nio/licenses/netty-resolver-4.1.25.Final.jar.sha1 @@ -0,0 +1 @@ +dc0965d00746b782b33f419b005cbc130973030d \ No newline at end of file diff --git a/plugins/transport-nio/licenses/netty-transport-4.1.16.Final.jar.sha1 b/plugins/transport-nio/licenses/netty-transport-4.1.16.Final.jar.sha1 deleted file mode 100644 index e502d4c77084c..0000000000000 --- a/plugins/transport-nio/licenses/netty-transport-4.1.16.Final.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -3c8ee2c4d4a1cbb947a5c184c7aeb2204260958b \ No newline at end of file diff --git a/plugins/transport-nio/licenses/netty-transport-4.1.25.Final.jar.sha1 b/plugins/transport-nio/licenses/netty-transport-4.1.25.Final.jar.sha1 new file mode 100644 index 0000000000000..1049ea4b98bc6 --- /dev/null +++ b/plugins/transport-nio/licenses/netty-transport-4.1.25.Final.jar.sha1 @@ -0,0 +1 @@ +19a6f1f649894b6705aa9d8cbcced188dff133b0 \ No newline at end of file diff --git a/x-pack/plugin/core/src/main/plugin-metadata/plugin-security.policy b/x-pack/plugin/core/src/main/plugin-metadata/plugin-security.policy index 0cd7a32bcc47b..1f1bd66005693 100644 --- a/x-pack/plugin/core/src/main/plugin-metadata/plugin-security.policy +++ b/x-pack/plugin/core/src/main/plugin-metadata/plugin-security.policy @@ -15,6 +15,8 @@ grant { grant codeBase "${codebase.netty-common}" { // for reading the system-wide configuration for the backlog of established sockets permission java.io.FilePermission "/proc/sys/net/core/somaxconn", "read"; + + permission java.lang.RuntimePermission "setContextClassLoader"; }; grant codeBase "${codebase.netty-transport}" { diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/license/AbstractLicensesIntegrationTestCase.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/license/AbstractLicensesIntegrationTestCase.java index e9c9ba95bfd38..03ce4ce246c8a 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/license/AbstractLicensesIntegrationTestCase.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/license/AbstractLicensesIntegrationTestCase.java @@ -3,6 +3,7 @@ * or more contributor license agreements. Licensed under the Elastic License; * you may not use this file except in compliance with the Elastic License. */ + package org.elasticsearch.license; import org.elasticsearch.analysis.common.CommonAnalysisPlugin; @@ -13,7 +14,7 @@ import org.elasticsearch.common.Nullable; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.plugins.Plugin; -import org.elasticsearch.test.ESIntegTestCase; +import org.elasticsearch.test.XPackIntegTestCase; import org.elasticsearch.xpack.core.LocalStateCompositeXPackPlugin; import org.elasticsearch.xpack.core.XPackClientPlugin; import org.elasticsearch.xpack.core.XPackSettings; @@ -22,7 +23,7 @@ import java.util.Collection; import java.util.concurrent.CountDownLatch; -public abstract class AbstractLicensesIntegrationTestCase extends ESIntegTestCase { +public abstract class AbstractLicensesIntegrationTestCase extends XPackIntegTestCase { @Override protected Settings nodeSettings(int nodeOrdinal) { diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/license/StartBasicLicenseTests.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/license/StartBasicLicenseTests.java index 12dd8ff9f3e3d..75d30c44ba38a 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/license/StartBasicLicenseTests.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/license/StartBasicLicenseTests.java @@ -3,6 +3,7 @@ * or more contributor license agreements. Licensed under the Elastic License; * you may not use this file except in compliance with the Elastic License. */ + package org.elasticsearch.license; import org.elasticsearch.client.Response; diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/test/ObjectCleanerThreadThreadFilter.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/test/ObjectCleanerThreadThreadFilter.java new file mode 100644 index 0000000000000..d5e0c574dce35 --- /dev/null +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/test/ObjectCleanerThreadThreadFilter.java @@ -0,0 +1,23 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +package org.elasticsearch.test; + +import com.carrotsearch.randomizedtesting.ThreadFilter; + +/** + * The Netty object cleaner thread is not closeable and it does not terminate in a timely manner. This means that thread leak control in + * tests will fail test suites when the object cleaner thread has not terminated. Since there is not a reliable way to terminate this + * thread we instead filter it out of thread leak control. + */ +public class ObjectCleanerThreadThreadFilter implements ThreadFilter { + + @Override + public boolean reject(final Thread t) { + return "ObjectCleanerThread".equals(t.getName()); + } + +} diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/test/XPackIntegTestCase.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/test/XPackIntegTestCase.java new file mode 100644 index 0000000000000..42363bebb7ea2 --- /dev/null +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/test/XPackIntegTestCase.java @@ -0,0 +1,13 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +package org.elasticsearch.test; + +import com.carrotsearch.randomizedtesting.annotations.ThreadLeakFilters; + +@ThreadLeakFilters(filters = {ObjectCleanerThreadThreadFilter.class}) +public abstract class XPackIntegTestCase extends ESIntegTestCase { +} diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/test/XPackSingleNodeTestCase.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/test/XPackSingleNodeTestCase.java new file mode 100644 index 0000000000000..893d01afe7f92 --- /dev/null +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/test/XPackSingleNodeTestCase.java @@ -0,0 +1,13 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +package org.elasticsearch.test; + +import com.carrotsearch.randomizedtesting.annotations.ThreadLeakFilters; + +@ThreadLeakFilters(filters = {ObjectCleanerThreadThreadFilter.class}) +public abstract class XPackSingleNodeTestCase extends ESSingleNodeTestCase{ +} diff --git a/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/support/BaseMlIntegTestCase.java b/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/support/BaseMlIntegTestCase.java index b030d1f0dd812..87bd656ab3a54 100644 --- a/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/support/BaseMlIntegTestCase.java +++ b/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/support/BaseMlIntegTestCase.java @@ -5,6 +5,7 @@ */ package org.elasticsearch.xpack.ml.support; +import com.carrotsearch.randomizedtesting.ThreadFilter; import org.apache.logging.log4j.Logger; import org.elasticsearch.action.admin.indices.recovery.RecoveryResponse; import org.elasticsearch.action.bulk.BulkItemResponse; @@ -25,22 +26,20 @@ import org.elasticsearch.plugins.Plugin; import org.elasticsearch.test.ESIntegTestCase; import org.elasticsearch.test.MockHttpTransport; +import org.elasticsearch.test.XPackIntegTestCase; import org.elasticsearch.test.discovery.TestZenDiscovery; import org.elasticsearch.xpack.core.XPackSettings; -import org.elasticsearch.xpack.core.ml.action.GetDatafeedsAction; -import org.elasticsearch.xpack.core.ml.action.GetJobsAction; -import org.elasticsearch.xpack.core.ml.action.util.QueryPage; -import org.elasticsearch.xpack.core.ml.client.MachineLearningClient; -import org.elasticsearch.xpack.ml.LocalStateMachineLearning; -import org.elasticsearch.xpack.ml.MachineLearning; import org.elasticsearch.xpack.core.ml.MachineLearningField; -import org.elasticsearch.xpack.core.ml.MlMetadata; import org.elasticsearch.xpack.core.ml.action.CloseJobAction; import org.elasticsearch.xpack.core.ml.action.DeleteDatafeedAction; import org.elasticsearch.xpack.core.ml.action.DeleteJobAction; +import org.elasticsearch.xpack.core.ml.action.GetDatafeedsAction; import org.elasticsearch.xpack.core.ml.action.GetDatafeedsStatsAction; +import org.elasticsearch.xpack.core.ml.action.GetJobsAction; import org.elasticsearch.xpack.core.ml.action.GetJobsStatsAction; import org.elasticsearch.xpack.core.ml.action.StopDatafeedAction; +import org.elasticsearch.xpack.core.ml.action.util.QueryPage; +import org.elasticsearch.xpack.core.ml.client.MachineLearningClient; import org.elasticsearch.xpack.core.ml.datafeed.DatafeedConfig; import org.elasticsearch.xpack.core.ml.datafeed.DatafeedState; import org.elasticsearch.xpack.core.ml.job.config.AnalysisConfig; @@ -50,6 +49,8 @@ import org.elasticsearch.xpack.core.ml.job.config.Job; import org.elasticsearch.xpack.core.ml.job.config.JobState; import org.elasticsearch.xpack.core.ml.job.process.autodetect.state.DataCounts; +import org.elasticsearch.xpack.ml.LocalStateMachineLearning; +import org.elasticsearch.xpack.ml.MachineLearning; import org.junit.After; import org.junit.Before; @@ -57,7 +58,6 @@ import java.util.Collection; import java.util.Collections; import java.util.List; -import java.util.Map; import java.util.concurrent.ExecutionException; import java.util.concurrent.atomic.AtomicReference; @@ -71,7 +71,21 @@ */ @ESIntegTestCase.ClusterScope(scope = ESIntegTestCase.Scope.TEST, numDataNodes = 0, numClientNodes = 0, transportClientRatio = 0, supportsDedicatedMasters = false) -public abstract class BaseMlIntegTestCase extends ESIntegTestCase { +public abstract class BaseMlIntegTestCase extends XPackIntegTestCase { + + /** + * The Netty object cleaner thread is not closeable and it does not terminate in a timely manner. This means that thread leak control in + * tests will fail test suites when the object cleaner thread has not terminated. Since there is not a reliable way to terminate this + * thread we instead filter it out of thread leak control. + */ + public static class ObjectCleanerThreadThreadFilter implements ThreadFilter { + + @Override + public boolean reject(final Thread t) { + return "ObjectCleanerThread".equals(t.getName()); + } + + } @Override protected boolean ignoreExternalCluster() { diff --git a/x-pack/plugin/security/src/main/plugin-metadata/plugin-security.policy b/x-pack/plugin/security/src/main/plugin-metadata/plugin-security.policy index 857c2f6e472d5..f56affec02be0 100644 --- a/x-pack/plugin/security/src/main/plugin-metadata/plugin-security.policy +++ b/x-pack/plugin/security/src/main/plugin-metadata/plugin-security.policy @@ -23,6 +23,8 @@ grant codeBase "${codebase.xmlsec-2.0.8.jar}" { grant codeBase "${codebase.netty-common}" { // for reading the system-wide configuration for the backlog of established sockets permission java.io.FilePermission "/proc/sys/net/core/somaxconn", "read"; + + permission java.lang.RuntimePermission "setContextClassLoader"; }; grant codeBase "${codebase.netty-transport}" { diff --git a/x-pack/plugin/security/src/test/java/org/elasticsearch/test/SecurityIntegTestCase.java b/x-pack/plugin/security/src/test/java/org/elasticsearch/test/SecurityIntegTestCase.java index 815f26942767a..1a2cf9deabaca 100644 --- a/x-pack/plugin/security/src/test/java/org/elasticsearch/test/SecurityIntegTestCase.java +++ b/x-pack/plugin/security/src/test/java/org/elasticsearch/test/SecurityIntegTestCase.java @@ -3,6 +3,7 @@ * or more contributor license agreements. Licensed under the Elastic License; * you may not use this file except in compliance with the Elastic License. */ + package org.elasticsearch.test; import io.netty.util.ThreadDeathWatcher; @@ -42,7 +43,6 @@ import org.elasticsearch.xpack.core.security.authc.support.UsernamePasswordToken; import org.elasticsearch.xpack.core.security.client.SecurityClient; import org.elasticsearch.xpack.security.LocalStateSecurity; - import org.elasticsearch.xpack.security.support.SecurityIndexManager; import org.junit.AfterClass; import org.junit.Before; @@ -75,7 +75,7 @@ * * @see SecuritySettingsSource */ -public abstract class SecurityIntegTestCase extends ESIntegTestCase { +public abstract class SecurityIntegTestCase extends XPackIntegTestCase { private static SecuritySettingsSource SECURITY_DEFAULT_SETTINGS; protected static SecureString BOOTSTRAP_PASSWORD = null; diff --git a/x-pack/plugin/security/src/test/java/org/elasticsearch/test/SecuritySingleNodeTestCase.java b/x-pack/plugin/security/src/test/java/org/elasticsearch/test/SecuritySingleNodeTestCase.java index cda627806e7b5..37ef8215ea4e2 100644 --- a/x-pack/plugin/security/src/test/java/org/elasticsearch/test/SecuritySingleNodeTestCase.java +++ b/x-pack/plugin/security/src/test/java/org/elasticsearch/test/SecuritySingleNodeTestCase.java @@ -3,8 +3,10 @@ * or more contributor license agreements. Licensed under the Elastic License; * you may not use this file except in compliance with the Elastic License. */ + package org.elasticsearch.test; +import com.carrotsearch.randomizedtesting.annotations.ThreadLeakFilters; import io.netty.util.ThreadDeathWatcher; import io.netty.util.concurrent.GlobalEventExecutor; import org.apache.http.HttpHost; @@ -49,7 +51,7 @@ * {@link SecurityIntegTestCase} due to simplicity and improved speed from not needing to start * multiple nodes and wait for the cluster to form. */ -public abstract class SecuritySingleNodeTestCase extends ESSingleNodeTestCase { +public abstract class SecuritySingleNodeTestCase extends XPackSingleNodeTestCase { private static SecuritySettingsSource SECURITY_DEFAULT_SETTINGS = null; private static CustomSecuritySettingsSource customSecuritySettingsSource = null; diff --git a/x-pack/plugin/watcher/src/test/java/org/elasticsearch/xpack/watcher/test/AbstractWatcherIntegrationTestCase.java b/x-pack/plugin/watcher/src/test/java/org/elasticsearch/xpack/watcher/test/AbstractWatcherIntegrationTestCase.java index 3461c530b4417..b33f0b4559d62 100644 --- a/x-pack/plugin/watcher/src/test/java/org/elasticsearch/xpack/watcher/test/AbstractWatcherIntegrationTestCase.java +++ b/x-pack/plugin/watcher/src/test/java/org/elasticsearch/xpack/watcher/test/AbstractWatcherIntegrationTestCase.java @@ -34,6 +34,7 @@ import org.elasticsearch.test.ESIntegTestCase; import org.elasticsearch.test.ESIntegTestCase.ClusterScope; import org.elasticsearch.test.InternalTestCluster; +import org.elasticsearch.test.XPackIntegTestCase; import org.elasticsearch.test.disruption.ServiceDisruptionScheme; import org.elasticsearch.test.store.MockFSIndexStore; import org.elasticsearch.test.transport.MockTransportService; @@ -94,7 +95,7 @@ import static org.hamcrest.core.IsNot.not; @ClusterScope(scope = SUITE, numClientNodes = 0, transportClientRatio = 0, maxNumDataNodes = 3) -public abstract class AbstractWatcherIntegrationTestCase extends ESIntegTestCase { +public abstract class AbstractWatcherIntegrationTestCase extends XPackIntegTestCase { public static final String WATCHER_LANG = Script.DEFAULT_SCRIPT_LANG;