Skip to content

Commit

Permalink
Use pooled Netty allocator in tests by default (elastic#100877)
Browse files Browse the repository at this point in the history
We mostly run our tests with less than 1G of heap per JVM. This means that
we will use the unpooled Netty allocator in most tests, losing us a lot of
leak coverage in internal cluster tests (mostly for inbound buffers).
Unless otherwise specified by tests, we should force the use of our standard
allocator by default to get a higher chance of catching leaks in internalClusterTests
in particular.
  • Loading branch information
original-brownbear authored Oct 16, 2023
1 parent 31736fc commit 04f37df
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,11 @@ private static void setTestSysProps() {

// Enable Netty leak detection and monitor logger for logged leak errors
System.setProperty("io.netty.leakDetection.level", "paranoid");
if (System.getProperty("es.use_unpooled_allocator") == null) {
// unless explicitly forced to unpooled, always test with the pooled allocator to get the best possible coverage from Netty's
// leak detection which does not cover simple unpooled heap buffers
System.setProperty("es.use_unpooled_allocator", "false");
}

// We have to disable setting the number of available processors as tests in the same JVM randomize processors and will step on each
// other if we allow them to set the number of available processors as it's set-once in Netty.
Expand Down

0 comments on commit 04f37df

Please sign in to comment.