From a48ed55069bf7dce77b322bc30c4070a2c85cd7d Mon Sep 17 00:00:00 2001 From: Tedi Mitiku Date: Tue, 15 Oct 2024 23:54:36 +0900 Subject: [PATCH] fix: use docker client without timeout for copy files operation (#2565) ## Description If the a user tries to do `store_service_files` on a large directory, they will receive a timeout. To fix this, use the docker client with no timeout when copying files from service container. ## Is this change user facing? NO --- .../user_services_functions/copy_files_from_user_service.go | 6 +++--- .../backend_impls/docker/docker_manager/docker_manager.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/container-engine-lib/lib/backend_impls/docker/docker_kurtosis_backend/user_services_functions/copy_files_from_user_service.go b/container-engine-lib/lib/backend_impls/docker/docker_kurtosis_backend/user_services_functions/copy_files_from_user_service.go index 1e5fa4ac7e..538bc62511 100644 --- a/container-engine-lib/lib/backend_impls/docker/docker_kurtosis_backend/user_services_functions/copy_files_from_user_service.go +++ b/container-engine-lib/lib/backend_impls/docker/docker_kurtosis_backend/user_services_functions/copy_files_from_user_service.go @@ -26,7 +26,6 @@ func CopyFilesFromUserService( output io.Writer, dockerManager *docker_manager.DockerManager, ) error { - srcPath := srcPathOnContainer srcPathBase := filepath.Base(srcPathOnContainer) if srcPathBase == doNotIncludeParentDirInArchiveSymbol { @@ -54,10 +53,11 @@ func CopyFilesFromUserService( } defer tarStreamReadCloser.Close() - if _, err := io.Copy(output, tarStreamReadCloser); err != nil { + if numBytesCopied, err := io.Copy(output, tarStreamReadCloser); err != nil { return stacktrace.Propagate( err, - "An error occurred copying the bytes of TAR'd up files at '%v' on service '%v' to the output", + "'%v' bytes copied before an error occurred copying the bytes of TAR'd up files at '%v' on service '%v' to the output", + numBytesCopied, srcPathOnContainer, serviceUuid, ) diff --git a/container-engine-lib/lib/backend_impls/docker/docker_manager/docker_manager.go b/container-engine-lib/lib/backend_impls/docker/docker_manager/docker_manager.go index bd4e771c04..b76e691028 100644 --- a/container-engine-lib/lib/backend_impls/docker/docker_manager/docker_manager.go +++ b/container-engine-lib/lib/backend_impls/docker/docker_manager/docker_manager.go @@ -1553,7 +1553,7 @@ func (manager *DockerManager) CopyFromContainer(ctx context.Context, containerId } } - tarStreamReadCloser, _, err := manager.dockerClient.CopyFromContainer( + tarStreamReadCloser, _, err := manager.dockerClientNoTimeout.CopyFromContainer( ctx, containerId, srcPath)