Skip to content

Commit 486f77d

Browse files
authored
Set netty available processors system property for tests globally (#75699) (#75757)
(cherry picked from commit 9d14bc9)
1 parent 5189710 commit 486f77d

File tree

12 files changed

+4
-102
lines changed

12 files changed

+4
-102
lines changed

modules/reindex/build.gradle

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,6 @@ testClusters.all {
3232
setting 'reindex.remote.whitelist', '127.0.0.1:*'
3333
}
3434

35-
tasks.named("test").configure {
36-
/*
37-
* We have to disable setting the number of available processors as tests in the
38-
* same JVM randomize processors and will step on each other if we allow them to
39-
* set the number of available processors as it's set-once in Netty.
40-
*/
41-
systemProperty 'es.set.netty.runtime.available.processors', 'false'
42-
}
43-
4435
dependencies {
4536
api project(":client:rest")
4637
api project(":libs:elasticsearch-ssl-config")

modules/transport-netty4/build.gradle

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -49,31 +49,13 @@ tasks.named("dependencyLicenses").configure {
4949
mapping from: /netty-.*/, to: 'netty'
5050
}
5151

52-
tasks.named("test").configure {
53-
/*
54-
* We have to disable setting the number of available processors as tests in the same JVM randomize processors and will step on each
55-
* other if we allow them to set the number of available processors as it's set-once in Netty.
56-
*/
57-
systemProperty 'es.set.netty.runtime.available.processors', 'false'
58-
}
59-
60-
tasks.named("internalClusterTest").configure {
61-
systemProperty 'es.set.netty.runtime.available.processors', 'false'
62-
}
63-
64-
tasks.named("javaRestTest").configure {
65-
systemProperty 'es.set.netty.runtime.available.processors', 'false'
66-
}
67-
6852
TaskProvider<Test> pooledTest = tasks.register("pooledTest", Test) {
6953
include '**/*Tests.class'
70-
systemProperty 'es.set.netty.runtime.available.processors', 'false'
7154
systemProperty 'es.use_unpooled_allocator', 'false'
7255
}
7356

7457
TaskProvider<Test> pooledInternalClusterTest = tasks.register("pooledInternalClusterTest", Test) {
7558
include '**/*IT.class'
76-
systemProperty 'es.set.netty.runtime.available.processors', 'false'
7759
systemProperty 'es.use_unpooled_allocator', 'false'
7860
SourceSetContainer sourceSets = project.getExtensions().getByType(SourceSetContainer.class);
7961
SourceSet internalTestSourceSet = sourceSets.getByName(InternalClusterTestPlugin.SOURCE_SET_NAME)
@@ -82,7 +64,6 @@ TaskProvider<Test> pooledInternalClusterTest = tasks.register("pooledInternalClu
8264
}
8365

8466
TaskProvider<RestIntegTestTask> pooledJavaRestTest = tasks.register("pooledJavaRestTest", RestIntegTestTask) {
85-
systemProperty 'es.set.netty.runtime.available.processors', 'false'
8667
SourceSetContainer sourceSets = project.getExtensions().getByType(SourceSetContainer.class);
8768
SourceSet javaRestTestSourceSet = sourceSets.getByName(JavaRestTestPlugin.SOURCE_SET_NAME)
8869
setTestClassesDirs(javaRestTestSourceSet.getOutput().getClassesDirs())

qa/smoke-test-http/build.gradle

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,3 @@ dependencies {
1919
testClusters.all {
2020
setting 'xpack.security.enabled', 'false'
2121
}
22-
23-
tasks.named("integTest").configure {
24-
/*
25-
* We have to disable setting the number of available processors as tests in the same JVM randomize processors and will step on each
26-
* other if we allow them to set the number of available processors as it's set-once in Netty.
27-
*/
28-
systemProperty 'es.set.netty.runtime.available.processors', 'false'
29-
}

test/framework/src/main/java/org/elasticsearch/test/ESTestCase.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,10 @@ private static void setTestSysProps() {
249249

250250
// Enable Netty leak detection and monitor logger for logged leak errors
251251
System.setProperty("io.netty.leakDetection.level", "paranoid");
252+
253+
// We have to disable setting the number of available processors as tests in the same JVM randomize processors and will step on each
254+
// other if we allow them to set the number of available processors as it's set-once in Netty.
255+
System.setProperty("es.set.netty.runtime.available.processors", "false");
252256
}
253257

254258
protected final Logger logger = LogManager.getLogger(getClass());

x-pack/plugin/build.gradle

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,6 @@ tasks.named("processYamlRestTestResources").configure {
114114
}
115115

116116
tasks.named("yamlRestTest").configure {
117-
/*
118-
* We have to disable setting the number of available processors as tests in the same JVM randomize processors and will step on each
119-
* other if we allow them to set the number of available processors as it's set-once in Netty.
120-
*/
121-
systemProperty 'es.set.netty.runtime.available.processors', 'false'
122-
123117
// TODO: fix this rest test to not depend on a hardcoded port!
124118
def blacklist = ['getting_started/10_monitor_cluster_health/*']
125119
if (BuildParams.isSnapshotBuild() == false) {

x-pack/plugin/core/build.gradle

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -112,14 +112,6 @@ sourceSets.test.resources {
112112
srcDir 'src/main/config'
113113
}
114114

115-
tasks.named("test").configure {
116-
/*
117-
* We have to disable setting the number of available processors as tests in the same JVM randomize processors and will step on each
118-
* other if we allow them to set the number of available processors as it's set-once in Netty.
119-
*/
120-
systemProperty 'es.set.netty.runtime.available.processors', 'false'
121-
}
122-
123115
// TODO: don't publish test artifacts just to run messy tests, fix the tests!
124116
// https://github.com/elastic/x-plugins/issues/724
125117

x-pack/plugin/data-streams/build.gradle

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,3 @@ dependencies {
1616
}
1717

1818
addQaCheckDependencies()
19-
20-
tasks.named("internalClusterTest").configure {
21-
/*
22-
* We have to disable setting the number of available processors as tests in the same JVM randomize processors and will step on each
23-
* other if we allow them to set the number of available processors as it's set-once in Netty.
24-
*/
25-
systemProperty 'es.set.netty.runtime.available.processors', 'false'
26-
}

x-pack/plugin/identity-provider/build.gradle

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -343,18 +343,6 @@ if (BuildParams.runtimeJavaVersion > JavaVersion.VERSION_1_8) {
343343
}
344344

345345

346-
tasks.named("test").configure {
347-
/*
348-
* We have to disable setting the number of available processors as tests in the same JVM randomize processors and will step on each
349-
* other if we allow them to set the number of available processors as it's set-once in Netty.
350-
*/
351-
systemProperty 'es.set.netty.runtime.available.processors', 'false'
352-
}
353-
354-
tasks.named("internalClusterTest").configure {
355-
systemProperty 'es.set.netty.runtime.available.processors', 'false'
356-
}
357-
358346
addQaCheckDependencies()
359347

360348
if (BuildParams.inFipsJvm) {

x-pack/plugin/ml/qa/native-multi-node-tests/build.gradle

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,6 @@ tasks.named("processJavaRestTestResources").configure { dependsOn("copyKeyCerts"
2626

2727
tasks.named("javaRestTest").configure {
2828
dependsOn "copyKeyCerts"
29-
/*
30-
* We have to disable setting the number of available processors as tests in the same JVM randomize processors and will step on each
31-
* other if we allow them to set the number of available processors as it's set-once in Netty.
32-
*/
33-
systemProperty 'es.set.netty.runtime.available.processors', 'false'
3429
}
3530

3631
testClusters.all {

x-pack/plugin/security/build.gradle

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -470,21 +470,7 @@ tasks.named("thirdPartyAudit").configure {
470470
}
471471

472472

473-
tasks.named("test").configure {
474-
/*
475-
* We have to disable setting the number of available processors as tests in the same JVM randomize processors and will step on each
476-
* other if we allow them to set the number of available processors as it's set-once in Netty.
477-
*/
478-
systemProperty 'es.set.netty.runtime.available.processors', 'false'
479-
}
480-
481473
tasks.named("internalClusterTest").configure {
482-
/*
483-
* We have to disable setting the number of available processors as tests in the same JVM randomize processors and will step on each
484-
* other if we allow them to set the number of available processors as it's set-once in Netty.
485-
*/
486-
systemProperty 'es.set.netty.runtime.available.processors', 'false'
487-
488474
/*
489475
* Some tests in this module set up a lot of transport threads so we reduce the buffer size per transport thread from the 1M default
490476
* to keep direct memory usage under control.

0 commit comments

Comments
 (0)