Give more memory to surefire when running the full test suite

There are so many tests now that their metadata takes up a considerable amount of memory.
This commit is contained in:
Chris Vest 2021-04-13 15:18:14 +02:00
parent 26f8bae997
commit 55348fb660
4 changed files with 14 additions and 3 deletions

View File

@ -33,4 +33,7 @@ RUN mvn dependency:go-offline surefire:test checkstyle:check -ntp
# Copy over the project code and run our build
COPY . .
# Make sure Maven has enough memory to keep track of all the tests we run
ENV MAVEN_OPTS="-Xmx3g -XX:+HeapDumpOnOutOfMemoryError"
# Run tests
CMD mvn verify -o -B -C -T1C -fae -nsu -npu

View File

@ -78,6 +78,7 @@
-server
-dsa -da -ea:io.netty...
-XX:+HeapDumpOnOutOfMemoryError
-Xmx3g
-Dio.netty.tryReflectionSetAccessible=true
--add-opens java.base/java.nio=io.netty.common
</argLine.common>

View File

@ -34,4 +34,4 @@ module netty.incubator.buffer {
io.netty.buffer.api.memseg.SegmentMemoryManagers,
io.netty.buffer.api.bytebuffer.ByteBufferMemoryManagers,
io.netty.buffer.api.unsafe.UnsafeMemoryManagers;
}
}

View File

@ -33,7 +33,6 @@ import java.nio.ReadOnlyBufferException;
import java.text.ParseException;
import java.time.Instant;
import java.time.temporal.ChronoUnit;
import java.time.temporal.TemporalUnit;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
@ -44,6 +43,7 @@ import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.SynchronousQueue;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Function;
@ -349,7 +349,14 @@ public class BufferTest {
@BeforeAll
static void startExecutor() throws IOException, ParseException {
executor = Executors.newSingleThreadExecutor();
executor = Executors.newSingleThreadExecutor(new ThreadFactory() {
@Override
public Thread newThread(Runnable r) {
Thread thread = Executors.defaultThreadFactory().newThread(r);
thread.setDaemon(true); // Do not prevent shut down of test runner.
return thread;
}
});
}
@AfterAll