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
crypto/x509: FetchPEMRoots in CGO crashed with signal SIGSEGV on go get gopkg.in/sourcemap.v1 on macOS Sierra (10.12.6) #24190
Comments
Hello there @ericreis, thank you for reporting this issue. So I have a somewhat similar environment on OS X $ go env
GOARCH="amd64"
GOBIN="/Users/emmanuelodeke/go/bin"
GOCACHE="/Users/emmanuelodeke/Library/Caches/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/emmanuelodeke/go"
GORACE=""
GOROOT="/Users/emmanuelodeke/go/src/go.googlesource.com/go"
GOTMPDIR=""
GOTOOLDIR="/Users/emmanuelodeke/go/src/go.googlesource.com/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/v3/7z434qpx5v3bw0wh8h2myfpw0000gn/T/go-build194242034=/tmp/go-build -gno-record-gcc-switches -fno-common" But I can't seem to reproduce this issue $ for ((i=0;i<10;i++)) do go run main.go;done
&http.Response{Status:"200 OK", StatusCode:200, Proto:"HTTP/2.0", ProtoMajor:2, ProtoMinor:0, Header:http.Header{"Content-Type":[]string{"text/html"}, "Content-Length":[]string{"358"}, "Date":[]string{"Fri, 02 Mar 2018 01:31:12 GMT"}}, Body:http.http2transportResponseBody{cs:(*http.http2clientStream)(0xc000238a00)}, ContentLength:358, TransferEncoding:[]string(nil), Close:false, Uncompressed:false, Trailer:http.Header(nil), Request:(*http.Request)(0xc00010c000), TLS:(*tls.ConnectionState)(0xc000492370)}
&http.Response{Status:"200 OK", StatusCode:200, Proto:"HTTP/2.0", ProtoMajor:2, ProtoMinor:0, Header:http.Header{"Content-Type":[]string{"text/html"}, "Content-Length":[]string{"358"}, "Date":[]string{"Fri, 02 Mar 2018 01:31:13 GMT"}}, Body:http.http2transportResponseBody{cs:(*http.http2clientStream)(0xc000408f00)}, ContentLength:358, TransferEncoding:[]string(nil), Close:false, Uncompressed:false, Trailer:http.Header(nil), Request:(*http.Request)(0xc00010c000), TLS:(*tls.ConnectionState)(0xc0000bcb00)}
&http.Response{Status:"200 OK", StatusCode:200, Proto:"HTTP/2.0", ProtoMajor:2, ProtoMinor:0, Header:http.Header{"Content-Type":[]string{"text/html"}, "Content-Length":[]string{"358"}, "Date":[]string{"Fri, 02 Mar 2018 01:31:14 GMT"}}, Body:http.http2transportResponseBody{cs:(*http.http2clientStream)(0xc0003ddb80)}, ContentLength:358, TransferEncoding:[]string(nil), Close:false, Uncompressed:false, Trailer:http.Header(nil), Request:(*http.Request)(0xc000126000), TLS:(*tls.ConnectionState)(0xc0004a6790)}
&http.Response{Status:"200 OK", StatusCode:200, Proto:"HTTP/2.0", ProtoMajor:2, ProtoMinor:0, Header:http.Header{"Content-Type":[]string{"text/html"}, "Content-Length":[]string{"358"}, "Date":[]string{"Fri, 02 Mar 2018 01:31:15 GMT"}}, Body:http.http2transportResponseBody{cs:(*http.http2clientStream)(0xc000312a00)}, ContentLength:358, TransferEncoding:[]string(nil), Close:false, Uncompressed:false, Trailer:http.Header(nil), Request:(*http.Request)(0xc00010c000), TLS:(*tls.ConnectionState)(0xc000488790)}
&http.Response{Status:"200 OK", StatusCode:200, Proto:"HTTP/2.0", ProtoMajor:2, ProtoMinor:0, Header:http.Header{"Content-Type":[]string{"text/html"}, "Content-Length":[]string{"358"}, "Date":[]string{"Fri, 02 Mar 2018 01:31:16 GMT"}}, Body:http.http2transportResponseBody{cs:(*http.http2clientStream)(0xc00048a3c0)}, ContentLength:358, TransferEncoding:[]string(nil), Close:false, Uncompressed:false, Trailer:http.Header(nil), Request:(*http.Request)(0xc00010c000), TLS:(*tls.ConnectionState)(0xc0000bcb00)}
&http.Response{Status:"200 OK", StatusCode:200, Proto:"HTTP/2.0", ProtoMajor:2, ProtoMinor:0, Header:http.Header{"Content-Type":[]string{"text/html"}, "Content-Length":[]string{"358"}, "Date":[]string{"Fri, 02 Mar 2018 01:31:17 GMT"}}, Body:http.http2transportResponseBody{cs:(*http.http2clientStream)(0xc0002588c0)}, ContentLength:358, TransferEncoding:[]string(nil), Close:false, Uncompressed:false, Trailer:http.Header(nil), Request:(*http.Request)(0xc00010c000), TLS:(*tls.ConnectionState)(0xc0002f84d0)}
&http.Response{Status:"200 OK", StatusCode:200, Proto:"HTTP/2.0", ProtoMajor:2, ProtoMinor:0, Header:http.Header{"Date":[]string{"Fri, 02 Mar 2018 01:31:18 GMT"}, "Content-Type":[]string{"text/html"}, "Content-Length":[]string{"358"}}, Body:http.http2transportResponseBody{cs:(*http.http2clientStream)(0xc00025e8c0)}, ContentLength:358, TransferEncoding:[]string(nil), Close:false, Uncompressed:false, Trailer:http.Header(nil), Request:(*http.Request)(0xc00010c000), TLS:(*tls.ConnectionState)(0xc0000bc840)}
&http.Response{Status:"200 OK", StatusCode:200, Proto:"HTTP/2.0", ProtoMajor:2, ProtoMinor:0, Header:http.Header{"Content-Type":[]string{"text/html"}, "Content-Length":[]string{"358"}, "Date":[]string{"Fri, 02 Mar 2018 01:31:18 GMT"}}, Body:http.http2transportResponseBody{cs:(*http.http2clientStream)(0xc00040fa40)}, ContentLength:358, TransferEncoding:[]string(nil), Close:false, Uncompressed:false, Trailer:http.Header(nil), Request:(*http.Request)(0xc00010c000), TLS:(*tls.ConnectionState)(0xc0000bcb00)}
&http.Response{Status:"200 OK", StatusCode:200, Proto:"HTTP/2.0", ProtoMajor:2, ProtoMinor:0, Header:http.Header{"Content-Type":[]string{"text/html"}, "Content-Length":[]string{"358"}, "Date":[]string{"Fri, 02 Mar 2018 01:31:19 GMT"}}, Body:http.http2transportResponseBody{cs:(*http.http2clientStream)(0xc00040edc0)}, ContentLength:358, TransferEncoding:[]string(nil), Close:false, Uncompressed:false, Trailer:http.Header(nil), Request:(*http.Request)(0xc00010c000), TLS:(*tls.ConnectionState)(0xc0000bcb00)}
&http.Response{Status:"200 OK", StatusCode:200, Proto:"HTTP/2.0", ProtoMajor:2, ProtoMinor:0, Header:http.Header{"Content-Type":[]string{"text/html"}, "Content-Length":[]string{"358"}, "Date":[]string{"Fri, 02 Mar 2018 01:31:20 GMT"}}, Body:http.http2transportResponseBody{cs:(*http.http2clientStream)(0xc00025e8c0)}, ContentLength:358, TransferEncoding:[]string(nil), Close:false, Uncompressed:false, Trailer:http.Header(nil), Request:(*http.Request)(0xc00010c000), TLS:(*tls.ConnectionState)(0xc000492790)} How often does this occur? Can you try running this in a loop like I did? for ((i=0;i<10;i++)) do go run main.go;done Is libexec a result of installing via Homebrew or some other ontap solution? Let me page some folks, @ianlancetaylor for cgo and signals and @bradfitz for HTTP. We both have CGO enabled but the biggest difference here is that I am on OS X El Capitan 10.11.6 (15G1611) while you are on Sierra 10.12.6. In the past we've encountered problems with Sierra, @bradfitz @ianlancetaylor perhaps this could be a useful hint? |
Hello @odeke-em. I'll answer each one of your questions: How often does this occur?I've tried like 50 times, across all the attempts to make it work (reinstalling go, upgrading macOS, etc.). All of them resulted in the same error. Can you try running this in a loop like I did?Just did and the outcome was the same in all the cases. The only difference between them was the goroutine number. Do you want me to post the full outcome of the 10 tries? Is libexec a result of installing via Homebrew or some other ontap solution?Yes, I installed go via Homebrew (brew install go). Also, I already tried with go@1.9 and go@1.8, both resulting in the same outcome. We both have CGO enabled but the biggest difference here is that I am on OS X El Capitan 10.11.6 (15G1611) while you are on Sierra 10.12.6. In the past we've encountered problems with Sierra, @bradfitz @ianlancetaylor perhaps this could be a useful hint?When I first tried I was on OS X El Capitan 10.11.6 too, so I think that it's not OS version related. |
Great, this is awesome, thank you for answering all my questions. Just one more, if you've got a C compiler on that Mac, could you please help me with the output of this code? #include <stdio.h>
#include <string.h>
#include <sys/sysctl.h>
int main() {
char str[256];
size_t size = sizeof(str);
memset(str, 0, size);
sysctlbyname("kern.osrelease", str, &size, NULL, 0);
printf("OS X release: %s\n", str);
} |
$ gcc main.c -o main && ./main
I guess the entire program crashed so no need to :) |
@odeke-em output: |
Thank you @ericreis for providing as much information, it is going to be useful later on. I have also installed Go via Homebrew like you did and then I have run it 10 times, all passing each time At least we've collected as much information, @ianlancetaylor and @bradfitz the floor is all yours. |
yeah, I really cannot understand what's going on... it seems to me that it's a problem with my machine. I was going to factory reset it and upgrade everything to see it solves the problem, but I'll wait to see if this is a real bug affecting other people. If it is, I want to help as much as I can in order to help improve the project. |
updating: It also happens with the following gopkg.in packages:
In all of them, I managed to get the packages from the latest releases (github.com/...). So I am guessing the problem is with all packages in gopkg.in. |
Oh interesting. @agl @FiloSottile any ideas/insights perhaps into why crypto.FetchPEMRoots might be failing for @ericreis or perhaps something weird about those certificates from |
Any news about my problem? I still haven't formatted my MacBook in order to solve this problem. |
Any chance you could sprinkle some printfs into the C code for FetchPEMRoots to figure out which line is segfaulting, and what the arguments are? This is not my area, but having details about exactly where the failure is occurring and what data is involved may help diagnose. Do take care not to expose any private certs though. :) |
@josharian I am sorry for the delay in response, I was busy with work. I searched a bit for this FetchPEMRoots C code but I didn't find it. Can you give me a hint on where it should be? |
@ericreis please see go/src/crypto/x509/root_cgo_darwin.go Line 80 in 29517da
go/src/crypto/x509/root_cgo_darwin.go Line 226 in 29517da
and the files in https://github.com/golang/go/tree/29517daff955b0188f0129b8da1578ae6201e851/src/crypto/x509 too |
I thought @josharian wanted me to printf the implementation of the FetchPEMRoots C code and not the go code that it's called. Is this the code commented in this go file? |
Oh yes, the C code is in the Go file as those commented lines, it uses cgo :) |
@odeke-em @josharian from my printfs the problem is in line 106: go/src/crypto/x509/root_cgo_darwin.go Line 106 in 29517da
It happens on the first iteration over the domains array in line 104: go/src/crypto/x509/root_cgo_darwin.go Lines 104 to 110 in 29517da
|
BIG UPDATE: I have just formated my macOS and the problem has disappeared. I will close this issue for now, but if anyone gets this error again feel free to reopen it. |
What version of Go are you using (
go version
)?go version go1.10 darwin/amd64
Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?macOS Sierra (10.12.6)
What did you do?
go get github.com/robertkrimen/otto
go get gopkg.in/sourcemap.v1
and the same problem occurredWhat did you expect to see?
Expected to not see the same SIGSEGV error.
What did you see instead?
The same SIGSEGV error:
The text was updated successfully, but these errors were encountered: