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

runtime: Mac OS High Sierra / XCode 9 native go executable gets "Segmentation fault: 11" #22059

Closed
bjornharvold opened this Issue Sep 27, 2017 · 19 comments

Comments

Projects
None yet
10 participants
@bjornharvold
Copy link

bjornharvold commented Sep 27, 2017

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

1.9 on command line but don't know what xcode command line tools uses

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

Mac OS High Sierra

What did you do?

Trying to execute a native go binary from Terminal

If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.

What did you expect to see?

Random string output as it did before I upgraded to High Sierra

What did you see instead?

Segmentation fault: 11

@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

ianlancetaylor commented Sep 27, 2017

What program are you running?

What is the complete output?

@ianlancetaylor ianlancetaylor changed the title Mac OS High Sierra / XCode 9 native go executable gets "Segmentation fault: 11" runtime: Mac OS High Sierra / XCode 9 native go executable gets "Segmentation fault: 11" Sep 27, 2017

@ianlancetaylor ianlancetaylor added this to the Go1.10 milestone Sep 27, 2017

@bjornharvold

This comment has been minimized.

Copy link

bjornharvold commented Sep 27, 2017

Hi @ianlancetaylor

It's a program a friend of mine wrote to simplify some of my calculation needs from the command line. I don't have the source. It just stopped working after I upgraded to High Sierra and Segmentation fault: 11 is all I get. Any way I can run with debug mode on it so I can see where it fails?

@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

ianlancetaylor commented Sep 27, 2017

There is no separate debug mode, but you could run it under the debugger (gdb or lldb).

It's hard to understand why the program would display only "Segmentation fault: 11". Go programs install a signal handler that catches signals and reports them. Does this program use cgo at all? Otherwise the only possibility I can think of would be that the signal handler itself is receiving a signal, which obviously shouldn't happen. The debugger might show that.

@bjornharvold

This comment has been minimized.

Copy link

bjornharvold commented Sep 28, 2017

I ran it using lldb and got this:
thread #1, stop reason = EXC_BAD_ACCESS (code=1, address=0xf5e656ba)
frame #0: 0x000505e9 dyldinitialPoolContent + 30761 dyldinitialPoolContent:
-> 0x505e9 <+30761>: movl 0x20(%ebp), %eax
0x505ec <+30764>: movl -0x4(%eax), %ebx
0x505ef <+30767>: movl %eax, %esp
0x505f1 <+30769>: calll 0x3f1b0 ; runtime.newstack

If it's a native go executable on Mac OS High Sierra I am assuming it uses cgo.

Can you recommend a signal handler to use and I can see if I can get any more info on this.

Cheers

@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

ianlancetaylor commented Sep 28, 2017

The Go runtime installs its own signal handler, there isn't any meaningful way to install a different signal handler.

It would be interesting to find out whether this crash occurs before the Go signal handler is installed, or whether it occurs while executing within the Go signal handler. The Go signal handler should certainly never call runtime.newstack.

@samuelkarp

This comment has been minimized.

Copy link

samuelkarp commented Sep 28, 2017

@ianlancetaylor Hello! I don't have a computer running High Sierra right now, but I did receive two reports of a Go program I help maintain failing with this same symptom on High Sierra: awslabs/amazon-ecr-credential-helper#69 and awslabs/amazon-ecr-credential-helper#70. You might be able to use https://github.com/awslabs/amazon-ecr-credential-helper to help debug.

@rasky

This comment has been minimized.

Copy link
Member

rasky commented Sep 30, 2017

@samuelkarp can you provide more details? I don't know what your program does, how to use it, and what environment it needs. I can't help debugging if I can't reproduce the bug. Can you work with your reporters to provide instructions for a reproducible environment that shows the bug?

@tejasmanohar

This comment has been minimized.

Copy link

tejasmanohar commented Oct 2, 2017

I had the same thing happen to me. FWIW, it was tj/robo built from source using go get back on 10.12. I doubt this is of much use, as I don't remember the exact Go version it was built with since it was a while ago... maybe 1.7.

@samuelkarp

This comment has been minimized.

Copy link

samuelkarp commented Oct 2, 2017

@rasky From the reports I received, I think it's sufficient to compile it on an older macOS release (or cross-compile from Linux) and then attempt to invoke the program. If you invoke it without arguments or any input to stdin, it should just print out a help message and exit with exit code 1.

@irthos

This comment has been minimized.

Copy link

irthos commented Nov 23, 2017

Re-installing Go from package at https://golang.org/dl/ did the trick for me.

@bjornharvold

This comment has been minimized.

Copy link

bjornharvold commented Nov 23, 2017

Still an issue for me. No progress on my end.

@zuoRambo

This comment has been minimized.

Copy link

zuoRambo commented Nov 27, 2017

Ok,I also meet this question and it was resolved!
I install the latest OS Mac OS High Sierra, and the revel can not work. It report error segmentation fault.
I reinstall the go by the follow command brew reinstall go.
After type the above command, my golang was upgrade to 1.9.2.
And then, rebuild revel command. go build github.com/revel/cmd/revel

@aclements

This comment has been minimized.

Copy link
Member

aclements commented Dec 1, 2017

Thanks for the reports, everyone, but we need more information to debug this.

It sounds like everyone has been able to get their binaries working by recompiling with a more recent toolchain (e.g., 1.9). That might mean there's nothing we can really do about this, but I'd like to confirm that.

Has anyone experienced this crash with a binary that was definitely built with 1.9 (or master)?

For anyone who still has a crashing binary around, I'd like to know what Go version it was compiled with. To find out, run go get rsc.io/goversion and run goversion <binary>.

@bjornharvold

This comment has been minimized.

Copy link

bjornharvold commented Dec 6, 2017

I'm trying to get goversion installed on Mac but can't seem to find where it is installed after executing your command. Eager to help.

@davecheney

This comment has been minimized.

Copy link
Contributor

davecheney commented Dec 6, 2017

@bjornharvold

This comment has been minimized.

Copy link

bjornharvold commented Dec 6, 2017

Thank you for that. The app that is not working for me was compiled with Go v1.6.2. I'm assuming I have to contact the developer of this program to recompile the binary with a newer version of Go? Can we safely say that Go v1.6.2 is not supported on High Sierra?

@davecheney

This comment has been minimized.

Copy link
Contributor

davecheney commented Dec 6, 2017

@bjornharvold

This comment has been minimized.

Copy link

bjornharvold commented Dec 6, 2017

Thanks Dave :-)

@aclements

This comment has been minimized.

Copy link
Member

aclements commented Dec 6, 2017

Thanks! For reference, the issue about improved forward-compatibility on macOS is #17490.

@golang golang locked and limited conversation to collaborators Dec 6, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.