Increase `timeout` default in `container_load`
๐ bug report
Affected Rule
container_load
Is this a regression?
No, it's arguable whether this is even a bug rather than a feature. I experienced it as a bug so that's how it's getting filed.
Description
When running container_load with a large tarfile, the build times out after loading for 600s or so.
๐ฌ Minimal Reproduction
The code uses a binary that relies on google/go-containerregistry. This binary doesn't timeout when it loads the file:
$ cache/repos/v1/content_addressable/sha256/5e5ada66beff07f9188bdc1f99c3fa37c407fc0048cd78b9c2047e9c5516f20b/file -directory /tmp/test -tarball ~/builds/NmXKkZyj/0/davidvandebunte/personal-notes/jb/docker/image.tar
2022/08/08 19:07:04 Running the Image Loader to load the image tarball...
2022/08/08 19:18:09 Successfully wrote docker image tarball to "/tmp/test"
The root cause is almost surely in repository_ctx.execute which has a 600s timeout.
The issue is similar to Container pull fails due to i/o timeout ยท Issue #1585 ยท bazelbuild/rules_docker and other issues along those lines. The logic there includes all of an environment variable (PULLER_TIMEOUT) and a parameter (timeout). See:
- https://github.com/bazelbuild/rules_docker/blob/master/container/pull.bzl#L216
As a first step, can we simply increase the default timeout from 600s to some higher hard-coded value like 2400s? It seems like the code should have a higher prior given how common large docker images are; my image is only a few packages installed on top of a jupyter/docker-stacks image. This fixes the problem for me:
- https://github.com/bazelbuild/rules_docker/compare/master...davidvandebunte:rules_docker:increase-container-load-timeout
๐ฅ Exception or Error
Repository rule container_load defined at:
/home/gitlab-runner/.cache/bazel/_bazel_gitlab-runner/75e20d18563f9f4a38b80b58afbbed1b/external/io_bazel_rules_docker/container/load.bzl:58:33: in <toplevel>
(16:31:32) ERROR: An error occurred during the fetch of repository 'install_conda_pip':
Traceback (most recent call last):
File "/home/gitlab-runner/.cache/bazel/_bazel_gitlab-runner/75e20d18563f9f4a38b80b58afbbed1b/external/io_bazel_rules_docker/container/load.bzl", line 56, column 13, in _impl
fail("Importing from tarball failed (status %s): %s" % (result.return_code, result.stderr))
Error in fail: Importing from tarball failed (status 256): Timed out
(16:31:32) ERROR: /home/gitlab-runner/builds/NmXKkZyj/0/davidvandebunte/personal-notes/WORKSPACE:46:15: fetching container_load rule //external:install_conda_pip: Traceback (most recent call last):
File "/home/gitlab-runner/.cache/bazel/_bazel_gitlab-runner/75e20d18563f9f4a38b80b58afbbed1b/external/io_bazel_rules_docker/container/load.bzl", line 56, column 13, in _impl
fail("Importing from tarball failed (status %s): %s" % (result.return_code, result.stderr))
Error in fail: Importing from tarball failed (status 256): Timed out
(16:31:32) ERROR: /home/gitlab-runner/builds/NmXKkZyj/0/davidvandebunte/personal-notes/jb/BUILD:76:16: //jb:datascience_with_source depends on @install_conda_pip//image:image in repository @install_conda_pip which failed to fetch. no such package '@install_conda_pip//image': Importing from tarball failed (status 256): Timed out
(16:31:32) ERROR: Analysis of target '//jb:extract_build_book' failed; build aborted:
(16:31:32) INFO: Elapsed time: 629.797s
๐ Your Environment
Operating System:
$ uname -a
Linux vandebun-dell-7920 5.14.0-1047-oem #54-Ubuntu SMP Tue Jul 26 11:27:04 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Output of bazel version:
$ bazel version
Build label: 5.2.0
Build target: bazel-out/k8-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Tue Jun 7 16:02:26 2022 (1654617746)
Build timestamp: 1654617746
Build timestamp as int: 1654617746
Rules_docker version:
0.22.0