-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix copy large files #8409
Fix copy large files #8409
Conversation
16693a6
to
3051f1f
Compare
Hi @joschi, thanks for the PR. What I had in mind for the issue is checking if copy file is supported to do an async operation and then implement it in docker-java and use it in Testcontainers. |
This is an attempt to fix `OutOfMemoryError` (out of heap memory) when copying large files into a container via `GenericContainer#withCopyFileToContainer()`. The previous implementation relied on an in-memory array backing a `ByteArrayInputStream` which represents the tar archive sent to the Docker daemon which is limited by the available heap memory of the JVM at the moment of execution. By using the local disk (temporary directory), we can copy files into the container which are larger than the available heap memory of the JVM. The caveat being that we are now limited by the available disk space in the temporary directory of the machine running Testcontainers. Fixes testcontainers#4203
Thanks for your contribution, @joschi ! PR has been updated to stream the files instead of use local disk. |
Fixing #7239 is amazing. Thank you so much! |
Fix `OutOfMemoryError` (out of heap memory) when copying large files into a container via `GenericContainer#withCopyFileToContainer()`. Fixes testcontainers#4203 --------- Co-authored-by: Eddú Meléndez <eddu.melendez@gmail.com>
This is an attempt to fix
OutOfMemoryError
(out of heap memory) when copying large files into a container viaGenericContainer#withCopyFileToContainer()
.The previous implementation relied on an in-memory array backing a
ByteArrayInputStream
which represents the tar archive sent to the Docker daemon which is limited by the available heap memory of the JVM at the moment of execution.By using the local disk (temporary directory), we can copy files into the container which are larger than the available heap memory of the JVM. The caveat being that we are now limited by the available disk space in the temporary directory of the machine running Testcontainers.
Maybe it could be useful to perform this conditionally depending on the size of the transferables or configurable via runtime property.
What do you think?
Fixes #4203