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

[Magic CLI]: Command “magic init my-project” runs indefinitely on Ubuntu 24.04.1 LTS #3872

Open
ZoaiCapital opened this issue Dec 12, 2024 · 12 comments
Assignees
Labels
magic-cli Anything related to the Magic CLI

Comments

@ZoaiCapital
Copy link

Issue description

The magic shell command runs indefinitely without completing or showing any output. Similarly, when trying to initialize a project using magic init my-project, the same behavior occurs. Both commands hang indefinitely without providing any feedback or errors.

Expected behavior:
The commands should complete successfully, either initializing a project or setting up the environment.

Steps to reproduce

Steps to Reproduce:

  • Install Magic CLI using the command:
curl -ssL https://magic.modular.com/4519bd52-ec0f-43e6-a8d1-865720aafd1e | bash
  • Verify installation using:
magic --version

CleanShot 2567-12-12 at 20 18 17@2x

The command confirms the CLI is installed successfully.

  • Run the following command to initialize a new project:
magic init my-project

CleanShot 2567-12-12 at 20 18 54@2x

Result: The command hangs indefinitely.

CleanShot 2567-12-12 at 20 19 13@2x

Version Info

- Provide magic CLI version by pasting the output of `magic --version`
magic 0.5.0 - (based on pixi 0.37.0)

- What OS did you install the magic CLI on?

Ubuntu 24.04.1 LTS

- Include your CPU architecture e.g. x86-64 or arm64.
x86_64
AMD Ryzen 9 7950X 16-Core Processor
@ZoaiCapital ZoaiCapital added magic-cli Anything related to the Magic CLI mojo-repo Tag all issues with this label labels Dec 12, 2024
@ematejska ematejska removed the magic-cli Anything related to the Magic CLI label Dec 12, 2024
@nguiard
Copy link

nguiard commented Dec 15, 2024

Hi, happening to me too:

  • magic 0.5.1 - (based on pixi 0.37.0)
  • Ubuntu 24.04.1 LTS
  • x86-64 - Intel Xeon W10885M

Edit: not happening (working fine) on another machine having Ubuntu 22.04 LTS, x86-64, magic 0.5.1

@zbowling
Copy link
Contributor

zbowling commented Dec 16, 2024

Can you run with -vv in the args. so magic init -vv my-project and paste the output?

@zbowling zbowling self-assigned this Dec 16, 2024
@zbowling zbowling added magic-cli Anything related to the Magic CLI and removed mojo-repo Tag all issues with this label labels Dec 16, 2024
@ZoaiCapital
Copy link
Author

I ran the command and let it execute for 2 minutes before interrupting it. The issue persists, as the execution hangs during this time.

CleanShot 2567-12-17 at 08 29 12@2x

@zbowling
Copy link
Contributor

can you try with --vvvv ? Increase the spam level further.

@zbowling
Copy link
Contributor

If you are on macos can you run sample magic --wait -f sample.txt on another shell before running magic and then post the spample.txt?

@ZoaiCapital
Copy link
Author

I still have the same issue.

CleanShot 2567-12-19 at 14 34 06@2x

On my mac it works well, the problem occurs on Ubuntu 24.04.1 LTS

CleanShot 2567-12-19 at 14 35 12@2x

@jakewins
Copy link

jakewins commented Dec 20, 2024

Have the same issue on Arch so I don't think it's an ubuntu problem.

Running strace it looks like it locks up at 100% CPU right after it closes some socket.. so I guess whatever magic does after it's done with that socket is the problem, maybe?

$  strace magic -vvv init example

<snip lots of syscalls>

stat("/home/jake/.modular/webUserId", {st_mode=S_IFREG|0644, st_size=37, ...}) = 0
open("/home/jake/.modular/webUserId", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = 9
fcntl(9, F_SETFD, FD_CLOEXEC)           = 0
fstat(9, {st_mode=S_IFREG|0644, st_size=37, ...}) = 0
read(9, "a9f21ffc-5228-4110-9dfa-c5301f82"..., 37) = 37
read(9, "", 32)                         = 0
close(9)                                = 0

socket(AF_NETLINK, SOCK_RAW|SOCK_CLOEXEC, NETLINK_ROUTE) = 9

<snip: Lots of sentto/recvfrom calls>

recvfrom(9, [{nlmsg_len=20, nlmsg_type=NLMSG_DONE, nlmsg_flags=NLM_F_MULTI, nlmsg_seq=2, nlmsg_pid=2145380}, 0], 8192, MSG_DONTWAIT, NULL, NULL) = 20
close(9)                                  = 0

<process stalls here, no more syscalls after that close()>
$ uname -a
Linux jake-p14 6.10.13-3-MANJARO #1 SMP PREEMPT_DYNAMIC Tue Oct  8 03:24:49 UTC 2024 x86_64 GNU/Linux

Copy link
Contributor

zbowling commented Dec 20, 2024

Thanks! I pushed a pre-release build of magic 0.6.0 that may (or may not) resolve the deadlocking issue a few people have been hitting. We still haven't been able to reproduce the issue some folks are seeing internally but this build has mitigations that might help from the traces we received and has an new ENV that may help if it still doesn't (based on hunch on where the issue might be coming from with doing socket establishment in certain network environments with a telemetry server even if telemetry isn't being sent).

You can install this (assuming magic isn't deadlocking for you) with magic self-update --prerelease.

If it is I made a script to directly reinstall this pre-release: curl -ssL https://gist.githubusercontent.com/zbowling/4153d8db6dc98ff4ecd73fbe65f4df92/raw/55d9a64273c68b38d6b7d9a19911b27ab9d4d46f/fetch.sh | bash

If it still locks up for you with this build you can try doing export MAGIC_TELEMETRY=false in your shell before invoking any commands and seeing if that resolves it for you.

@nguiard
Copy link

nguiard commented Dec 20, 2024

Hi @zbowling , thanks! So, for information, in my case:

  • doing just magic self-update --prerelease deadlocked
  • before trying your script, I figure I'd try MAGIC_TELEMETRY=false magic self-update --prerelease. This deadlocked too
  • your script worked for upgrading
  • trying magic init my-project after upgrading still deadlocked
  • doing MAGIC_TELEMETRY=false magic init my-project, however, worked without a problem

@jakewins
Copy link

Can confirm the same, export MAGIC_TELEMETRY=false after running your bash script made things work.

Flipping that env var back to false makes it deadlock again.

Thanks for looking into this!

Copy link
Contributor

Awesome. Thanks for letting me know. Still trying to get a repro internally but the fact that new env override works narrows it down a bit. It’s something about specific network environments I can’t replicate and probably an updated crash reporting, telemetry, and SSL library not all playing well together.

If you don’t want to keep setting the env you can also now do ‘magic telemetry --disable’ and it should persist and avoid the issue on that build.

@ZoaiCapital
Copy link
Author

Thanks for the quick update and the patch!

The pre-release build of magic 0.6.0 resolved the deadlocking issue for me. I used the provided curl command to install the pre-release and followed the instructions:

export MAGIC_TELEMETRY=false
magic init my-project

Everything is working smoothly now. Thanks for your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
magic-cli Anything related to the Magic CLI
Projects
None yet
Development

No branches or pull requests

5 participants