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

'unused' terminated by signal SIGSEGV (Address boundary error) #34

Closed
sergiopantoja opened this issue Mar 23, 2021 · 20 comments
Closed

Comments

@sergiopantoja
Copy link

Hello! When running unused, unused --help, and unused doctor, I get the following error:

With fish:

fish: 'unused' terminated by signal SIGSEGV (Address boundary error)

With zsh:

zsh: segmentation fault  unused

I have unused version 0.2.0 installed via Homebrew (unused-code/formulae) on macOS Big Sur 11.2.3 with an M1 Macbook. ctags were successfully generated with Universal Ctags. Maybe it's something weird with the M1 architecture?

If there's anything I can do to help debug, let me know!

@joshuaclayton
Copy link
Member

@sergiopantoja thanks for reporting this!

Any chance you'd be able to confirm you see this outside of fish? I can't imagine that'd be a culprit, but I've only run it in zsh so it might be a good place to start.

If I had to guess, it's more likely bound to issues with ARM than anything else. I've got an ARM Mac available that I can try this out on as well to see if I run into the same issues.

Out of curiosity, how large is the codebase? Reporting cat .git/tags | wc -l would probably be enough here.

Thanks!

@sergiopantoja
Copy link
Author

@joshuaclayton My pleasure! In zsh it shows:

zsh: segmentation fault  unused

I just tried it on an Intel Macbook with the same version of macOS and fish shell and it worked perfectly. So looks like it's an M1/ARM issue like you said.

Out of curiosity, how large is the codebase? Reporting cat .git/tags | wc -l would probably be enough here.

$ ctags -R -f .git/tags --languages=ruby --exclude=.git --exclude=log .
$ cat .git/tags | wc -l
    5950

@joshuaclayton
Copy link
Member

@sergiopantoja I've got another wrinkle; I was able to install this on an M1 and ran it on the discourse codebase without issue (I'm using the latest homebrew-installed zsh on that machine).

unused doctor works as well.

Maybe it's a combination fish + M1 issue? I think the only other thing worth calling out is that I'm running it through tmux.

🤷‍♂️

@sergiopantoja
Copy link
Author

Huh interesting! Thank you for taking the time to try it with that setup.

I'll tinker with it a bit more and let you know if I find any other leads. In the meantime, I have a hold of that other laptop where it's working, so that'll work for me for now! My delete key is gonna get a lot of use over the next few days. 😛

@jcamblan
Copy link

➜  some-api git:(build/update-ruby) unused
[1]    42029 segmentation fault  unused

I'm almost experiencing the exact same error on zsh on my M1 Macbook running macOS Big Sur 11.2.3. I will follow Sergio's example and use another Mac while hoping that someone will come up with a solution to our problem!

🙏

@joshuaclayton
Copy link
Member

@jcamblan @marckohlbrugge I'm sorry to hear this is still cropping up.

Out of curiosity, are you using fish, zsh, bash, or another shell entirely?

Second, did you happen to install Homebrew in /opt (which I believe was the recommendation back when Homebrew initially started supporting ARM), or have you been using /usr/local?

I – along with a bunch of other folks – am also hoping that GH Actions will eventually support ARM on Mac so we could include that with the release script (tracked here: actions/runner-images#2187)

@marckohlbrugge
Copy link

@joshuaclayton I'm running on default as much as possible. So homebrew is installed in /opt (default for Apple Silicon) and zsh as my shell.

@jcamblan
Copy link

Same here, zsh as shell and homebrew installed in /opt.

@joshuaclayton
Copy link
Member

@marckohlbrugge @jcamblan hmm – out of curiosity, when did you get Homebrew set up?

I ask because I recently set up a new MBP back in March – at which point the recommendation was to install in /usr/local with support for most things.

Do either of you have a Brewfile that'd make it easy to tear everything down and rebuild from Homebrew's most recent instructions? I realize this isn't a small task, but depending on when you tried to get Homebrew installed (based on /opt, maybe when things were still shaky?), that might be the cause.

@marckohlbrugge
Copy link

marckohlbrugge commented May 14, 2021 via email

@joshuaclayton
Copy link
Member

@marckohlbrugge oh, fascinating! I've been running it under /usr/local since I picked up my M1.

It's still not super clear what the problem would be; a few ideas, if you're interested (it may require some setup!):

  • Installing with Rust directly and seeing if that works
  • Wiping/rebuilding your Homebrew setup (that's where the Brewfile comes in handy!)
  • Trying another shell, like bash, to see if there's something with your current shell that's somehow mucking with things (I'm not sure why this would cause it, but it's worth trying maybe?)

@marckohlbrugge
Copy link

marckohlbrugge commented Jun 8, 2021

@joshuaclayton The first two steps are bit too scary for me right now as I don't wanna risk messing with my setup. I did try running unused through bash (instead of zsh) and got a similar error:

$ /opt/homebrew/bin/unused
Segmentation fault: 11

I understand that this isn't much to go on so I don't expect future updates on this issue. Hopefully someone else is willing to try some of your other suggestions. Thanks for your work regardless!

@joshuaclayton
Copy link
Member

@marckohlbrugge yeah, that's totally understandable.

One thought I had was that it might have something to do with mimalloc. This issue is closed but leads me to believe it's a path worth exploring. What's odd to me is that I'm running on an M1 and am not having problems.

I've just opened a PR here, and will refamiliarize myself with Homebrew's feature flagging to see if I can have it point to this branch for you to test out 😬.

@joshuaclayton
Copy link
Member

@marckohlbrugge Alright! Want to give this a try?

brew untap unused-code/formulae
brew tap unused-code/formulae
brew install unused  --without-mimalloc --HEAD

Once you're set with this, could you give unused another try?

@marckohlbrugge
Copy link

marckohlbrugge commented Jun 14, 2021

@joshuaclayton That worked! ❤️

@joshuaclayton
Copy link
Member

@jcamblan @sergiopantoja would you both be up for giving these instructions a try?

If this works, I'll update the installation docs and cut a new patch-level release with the mimalloc flag option to close this out.

@sergiopantoja
Copy link
Author

@joshuaclayton Worked for me too! Small edit to the instructions, I had to brew uninstall unused before brew let me do brew untap unused-code/formulae

Thank you!

@jcamblan
Copy link

jcamblan commented Jun 16, 2021

@joshuaclayton It works for me as well, thank you very much. 🙌

@joshuaclayton
Copy link
Member

@sergiopantoja @jcamblan @marckohlbrugge thanks for your patience while I got this sorted!

I've released version 0.2.2 of unused, which includes a feature flag to enable mimalloc. I've also updated the Homebrew formula to opt out of mimalloc use. Finally, I've gone ahead and updated the README to account for the additional configuration, including the suggestion to uninstall/untap and then try again.

I'm hoping that as mimalloc gets wider adoption, the ARM issues will iron themselves on the Apple M1s and folks can use it (especially considering it's significantly faster than the default).

@marckohlbrugge
Copy link

Thanks for all your hard work on this @joshuaclayton 🎉 ❤️

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

No branches or pull requests

4 participants