Hi,
We've recently seen OOM in our tests and after debugging by generating a heap dump and opening it, we found that for the following code that we use in XWiki tests, TC is copying all the content of the sourceDirectory in memory:
MountableFile mountableDirectory = MountableFile.forHostPath(sourceDirectory);
container.withCopyFileToContainer(mountableDirectory, targetDirectory);
Since our directory contains 300MB+ of files, the memory we give to the JVM is not enough.
Note that we copy and don't bind because we need to have it work in the DOOD use case. Our code is:
protected void mountFromHostToContainer(GenericContainer<?> container, String sourceDirectory,
String targetDirectory)
{
// Note 1: File mounting is awfully slow on Mac OSX. For example starting Tomcat with XWiki mounted takes
// 45s+, while doing a COPY first and then starting Tomcat takes 8s (+5s for the copy).
// Note 2: For the DOOD use case, we also do the copy instead of the volume mounting since that would require
// to have the sourceDirectory path mounted from the host and this would put and leave files on the host which
// would not work with parallel executions (think about multiple CI jobs executing in parallel on the same host)
// and would also not be clean.
String osName = System.getProperty("os.name").toLowerCase();
if (isInAContainer() || osName.startsWith("mac os x")) {
MountableFile mountableDirectory = MountableFile.forHostPath(sourceDirectory);
container.withCopyFileToContainer(mountableDirectory, targetDirectory);
} else {
container.withFileSystemBind(sourceDirectory, targetDirectory);
}
}
It would be great if TC could stream the data instead of keeping it in memory. Is that possible?
Thanks
Hi,
We've recently seen OOM in our tests and after debugging by generating a heap dump and opening it, we found that for the following code that we use in XWiki tests, TC is copying all the content of the
sourceDirectoryin memory:Since our directory contains 300MB+ of files, the memory we give to the JVM is not enough.
Note that we copy and don't bind because we need to have it work in the DOOD use case. Our code is:
It would be great if TC could stream the data instead of keeping it in memory. Is that possible?
Thanks