-
Notifications
You must be signed in to change notification settings - Fork 20
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
shell: Command hangs when --conda
is used and the runtime has not been set up
#363
Comments
I'm curious why it just hangs 🤔 Tangentialy, it seems like the error message for
I think this we can accomplish this by checking runtime setup before trying to run anything. diff --git a/nextstrain/cli/runner/__init__.py b/nextstrain/cli/runner/__init__.py
index 0aaefd0..6bc1388 100644
--- a/nextstrain/cli/runner/__init__.py
+++ b/nextstrain/cli/runner/__init__.py
@@ -14,7 +14,7 @@ from .. import config, env, hostenv
from ..argparse import DirectoryPath, SKIP_AUTO_DEFAULT_IN_HELP
from ..errors import UserError
from ..types import EllipsisType, Env, Options, RunnerModule
-from ..util import prose_list, runner_name, runner_module, runner_help, warn
+from ..util import prose_list, runner_name, runner_module, runner_help, warn, runner_tests_ok, print_runner_tests
from ..volume import NamedVolume
@@ -277,6 +277,13 @@ def run(opts: Options, working_volume: NamedVolume = None, extra_env: Env = {},
**dict(hostenv.forwarded_values()),
**extra_env }
+ tests = opts.__runner__.test_setup()
+ if not runner_tests_ok(tests):
+ print(f"The {runner_name(opts.__runner__)} is not supported.")
+ print()
+ print_runner_tests(tests)
+ return 1
+
return opts.__runner__.run(opts, argv, working_volume = working_volume, extra_env = extra_env, cpus = cpus, memory = memory) |
Sure, but probably not with that patch as-is? Runner tests sometimes still produce a bunch of junk output to stdout (should fix that!) and they're also sometimes slow (seconds instead of milliseconds). I'd suggest a more cursory check for "is it good?" instead as the guard, or perhaps running the full tests only on failure to actually run, as part of better error reporting. |
The hanging is interesting. Perhaps something about macOS or something about your specific system? If I try I get a shell, but of course no runtime is available (bad, but better than hang):
|
I'm on a different computer now (macOS 13.6 Apple M1 chip) and can't reproduce. I'll try again on my home computer which is where I observed this initially. Is there any extra logging that would be helpful here, maybe something around these lines? cli/nextstrain/cli/runner/conda.py Lines 388 to 391 in 25075fa
|
Well, that snippet of code is in cli/nextstrain/cli/runner/conda.py Line 170 in 25075fa
Lines 322 to 328 in 25075fa
If the hang is somewhere in Python before the exec, then logging around it could be helpful. But I suspect it's after the exec and we're no longer in Python. What output did you see before it hung? Anything? That would be a useful clue. Would also be useful to enable existing debug logging (which is minimal, but a little relevant here), e.g.
Beyond that, what I'd reach for first is process inspection (from the outside). i.e. looking at the process tree, the output of |
Thanks, I'll poke around on my home computer sometime and report back. Output is in the issue description – I had it collapsed but just edited so it's more visible. |
Ah! Thanks. I clearly missed it! 🙃 So seeing |
I was able to reproduce on my home computer, but only by removing Here's the debug output:
and the same with
|
Can reproduce on my work computer and the blab Mac Mini, but not a GitHub Codespace.
|
We had a debugging session this morning. Here's a reproducible example: cat >bad-histfile <<~~
#anything here
ls
~~
cat >bad-rcfile <<~~
HISTSIZE=-1
~~
HISTFILE=bad-histfile /bin/bash --rcfile bad-rcfile |
Scratch the comment that my work computer uses bash 5.2.15. It does in my normal startup shell (zsh) that adds A negative value for |
Ah, really good to know that 5.2.15 isn't actually affected. I can repro the issue on Linux with Bash 3.2.57. This lets me strace it, which shows that immediately after reading the history file it enters an infinite loop of segfaults, each of which invokes its registered SIGSEGV handler. We could adjust |
The flip side to this where it "works" on newer versions of bash can also be considered a bug - the shell appears to enter a conda runtime that doesn't exist. This is also solved by erroring when the runtime isn't available. |
Current Behavior
I thought I had the Conda runtime set up on my computer so I used
nextstrain shell --conda
. It resulted in a process that hung indefinitely using 100% CPU even upon closing the terminal. I was able to terminate the process throughkill -9 <PID>
(SIGTERM
) and Activity Monitor's "Force Quit" option.Console output:
Closed that terminal and opened another. Here you can see it's been running for 4 minutes.
Expected behavior
This is partly user error since
--conda
is useless without the runtime being set up. But the command should at least be easily terminable, or even better exit with a useful error saying that the Conda runtime has not been set up yet.How to reproduce
Steps to reproduce the current behavior:
nextstrain shell --conda .
in an environment without the Conda runtime available.Your environment: if running Nextstrain locally
Hardware: macOS 14.3.1 Apple M2 chip
The text was updated successfully, but these errors were encountered: