Skip to content

Commit 3036d53

Browse files
Tim-Brooksjkakavas
authored andcommitted
Set netty system properties in BuildPlugin (elastic#45881)
Currently in production instances of Elasticsearch we set a couple of system properties by default. We currently do not apply all of these system properties in tests. This commit applies these properties in the tests.
1 parent a7a2843 commit 3036d53

File tree

3 files changed

+6
-9
lines changed

3 files changed

+6
-9
lines changed

buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -887,6 +887,12 @@ class BuildPlugin implements Plugin<Project> {
887887
// TODO: remove this once cname is prepended to transport.publish_address by default in 8.0
888888
test.systemProperty 'es.transport.cname_in_publish_address', 'true'
889889

890+
// Set netty system properties to the properties we configure in jvm.options
891+
test.systemProperty('io.netty.noUnsafe', 'true')
892+
test.systemProperty('io.netty.noKeySetOptimization', 'true')
893+
test.systemProperty('io.netty.recycler.maxCapacityPerThread', '0')
894+
test.systemProperty('io.netty.allocator.numDirectArenas', '0')
895+
890896
test.testLogging { TestLoggingContainer logging ->
891897
logging.showExceptions = true
892898
logging.showCauses = true

modules/transport-netty4/build.gradle

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,6 @@ test {
5151
* other if we allow them to set the number of available processors as it's set-once in Netty.
5252
*/
5353
systemProperty 'es.set.netty.runtime.available.processors', 'false'
54-
55-
// Disable direct buffer pooling as it is disabled by default in Elasticsearch
56-
systemProperty 'io.netty.allocator.numDirectArenas', '0'
5754
}
5855

5956
integTestRunner {
@@ -62,9 +59,6 @@ integTestRunner {
6259
* other if we allow them to set the number of available processors as it's set-once in Netty.
6360
*/
6461
systemProperty 'es.set.netty.runtime.available.processors', 'false'
65-
66-
// Disable direct buffer pooling as it is disabled by default in Elasticsearch
67-
systemProperty 'io.netty.allocator.numDirectArenas', '0'
6862
}
6963

7064
thirdPartyAudit {

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -242,9 +242,6 @@ private static void setTestSysProps() {
242242

243243
// Enable Netty leak detection and monitor logger for logged leak errors
244244
System.setProperty("io.netty.leakDetection.level", "paranoid");
245-
246-
// Disable direct buffer pooling
247-
System.setProperty("io.netty.allocator.numDirectArenas", "0");
248245
}
249246

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

0 commit comments

Comments
 (0)