Skip to content
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

Docker command runner hangs #16847

Closed
Eric-Arellano opened this issue Sep 13, 2022 · 2 comments
Closed

Docker command runner hangs #16847

Eric-Arellano opened this issue Sep 13, 2022 · 2 comments
Assignees
Labels

Comments

@Eric-Arellano
Copy link
Contributor

Eric-Arellano commented Sep 13, 2022

To reproduce, apply this diff:

diff --git a/src/python/pants/backend/project_info/count_loc.py b/src/python/pants/backend/project_info/count_loc.py
index 9c45298b32..403d972988 100644
--- a/src/python/pants/backend/project_info/count_loc.py
+++ b/src/python/pants/backend/project_info/count_loc.py
@@ -7,6 +7,7 @@ from pants.core.util_rules.external_tool import (
     TemplatedExternalTool,
 )
 from pants.engine.console import Console
+from pants.engine.environment import EnvironmentName
 from pants.engine.fs import Digest, MergeDigests, PathGlobs, SpecsPaths
 from pants.engine.goal import Goal, GoalSubsystem
 from pants.engine.platform import Platform
@@ -79,12 +80,16 @@ async def count_loc(
     input_digest = await Get(Digest, MergeDigests((scc_program.digest, specs_digest)))
     result = await Get(
         ProcessResult,
-        Process(
-            argv=(scc_program.exe, *succinct_code_counter.args),
-            input_digest=input_digest,
-            description=f"Count lines of code for {pluralize(len(specs_paths.files), 'file')}",
-            level=LogLevel.DEBUG,
-        ),
+        {
+            Process(
+                argv=(scc_program.exe, *succinct_code_counter.args),
+                input_digest=input_digest,
+                description=f"Count lines of code for {pluralize(len(specs_paths.files), 'file')}",
+                level=LogLevel.DEBUG,
+            ): Process,
+            EnvironmentName("docker"): EnvironmentName,
+            # EnvironmentName("default_env"): EnvironmentName,
+        },
     )
     console.print_stdout(result.stdout.decode())
     return CountLinesOfCode(exit_code=0)

Then run:

❯ ./pants count-loc build-support/
14:29:43.64 [INFO] Initializing scheduler...
14:29:44.33 [INFO] Scheduler initialized.
⠉ 5.42s Count lines of code for 5 files
@Eric-Arellano Eric-Arellano self-assigned this Sep 13, 2022
@Eric-Arellano Eric-Arellano changed the title Bash discovery hangs when using Docker Docker command runner hangs Sep 13, 2022
@Eric-Arellano
Copy link
Contributor Author

@tdyas and I figured this out. My Docker was acting up and docker pull was failing with this directly on the CLI:

❯ docker pull python:3.9
Error response from daemon: error creating temporary lease: connection error: desc = "transport: Error while dialing dial unix /var/run/desktop-containerd/containerd.sock: connect: connection refused": unavailable

Pants was not properly logging this nor erroring, and instead hung.

We "fixed it" by restarting Docker

@Eric-Arellano Eric-Arellano assigned tdyas and unassigned Eric-Arellano Sep 13, 2022
@tdyas
Copy link
Contributor

tdyas commented Sep 13, 2022

Pants was not logging when it was pulling an image. #16849 adds this logging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants