{"action":"created","issue":{"url":"https://api.github.com/repos/buildkite/agent/issues/370","repository_url":"https://api.github.com/repos/buildkite/agent","labels_url":"https://api.github.com/repos/buildkite/agent/issues/370/labels{/name}","comments_url":"https://api.github.com/repos/buildkite/agent/issues/370/comments","events_url":"https://api.github.com/repos/buildkite/agent/issues/370/events","html_url":"https://github.com/buildkite/agent/issues/370","id":171587208,"number":370,"title":"Linking statically to glibc causes segfaults","user":{"login":"grosskur","id":40483,"avatar_url":"https://avatars.githubusercontent.com/u/40483?v=3","gravatar_id":"","url":"https://api.github.com/users/grosskur","html_url":"https://github.com/grosskur","followers_url":"https://api.github.com/users/grosskur/followers","following_url":"https://api.github.com/users/grosskur/following{/other_user}","gists_url":"https://api.github.com/users/grosskur/gists{/gist_id}","starred_url":"https://api.github.com/users/grosskur/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grosskur/subscriptions","organizations_url":"https://api.github.com/users/grosskur/orgs","repos_url":"https://api.github.com/users/grosskur/repos","events_url":"https://api.github.com/users/grosskur/events{/privacy}","received_events_url":"https://api.github.com/users/grosskur/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2016-08-17T06:55:03Z","updated_at":"2016-08-19T08:32:30Z","closed_at":null,"body":"We're seeing a segfault when running `buildkite artifact download` on a `gs://` URL:\r\n\r\n    2016-08-12 13:32:57 INFO   Found 7 artifacts. Starting to download to: /app\r\n    fatal error: unexpected signal during runtime execution\r\n    fatal error: unexpected signal during runtime execution\r\n    fatal error: unexpected signal during runtime execution\r\n    fatal error: unexpected signal during runtime execution\r\n    fatal error: unexpected signal during runtime execution\r\n    fatal error: unexpected signal during runtime execution\r\n    [signal 0xb code=0x1 addr=0xe5 pc=0x7fc6d418c8cc]\r\n    \r\n    runtime stack:\r\n    runtime.throw(0xb67de0, 0x2a)\r\n            /usr/local/go/src/runtime/panic.go:547 +0x90\r\n    runtime.sigpanic()\r\n            /usr/local/go/src/runtime/sigpanic_unix.go:12 +0x5a\r\n    \r\n    goroutine 33 [syscall, locked to thread]:\r\n    runtime.cgocall(0x83cf90, 0xc8204a7658, 0x0)\r\n            /usr/local/go/src/runtime/cgocall.go:123 +0x11b fp=0xc8204a7600 sp=0xc8204a75d0\r\n    os/user._Cfunc_mygetpwuid_r(0x0, 0xc82038a000, 0x7fc6c4000b20, 0x400, 0xc8204b2000, 0x0)\r\n            ??:0 +0x44 fp=0xc8204a7658 sp=0xc8204a7600\r\n    os/user.lookupUnix(0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)\r\n            /usr/local/go/src/os/user/lookup_unix.go:95 +0xcd8 fp=0xc8204a77f0 sp=0xc8204a7658\r\n    os/user.current(0x40e7c0, 0x0, 0x0)\r\n            /usr/local/go/src/os/user/lookup_unix.go:38 +0x42 fp=0xc8204a7830 sp=0xc8204a77f0\r\n    os/user.Current(0x4ffe2d, 0x0, 0x0)\r\n            /usr/local/go/src/os/user/lookup.go:9 +0x24 fp=0xc8204a7850 sp=0xc8204a7830\r\n    github.com/buildkite/agent/vendor/golang.org/x/oauth2/google.guessUnixHomeDir(0x0, 0x0)\r\n            /go/src/github.com/buildkite/agent/vendor/golang.org/x/oauth2/google/sdk.go:163 +0x28  fp=0xc8204a7888 sp=0xc8204a7850\r\n    github.com/buildkite/agent/vendor/golang.org/x/oauth2/google.wellKnownFile(0x0, 0x0)\r\n            /go/src/github.com/buildkite/agent/vendor/golang.org/x/oauth2/google/default.go:107 +0x36 fp=0xc8204a7920 sp=0xc8204a7888\r\n    github.com/buildkite/agent/vendor/golang.org/x/oauth2/google.DefaultTokenSource(0x7fc6d5d86658, 0xc8200114b8, 0xc8204a7c38, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0)\r\n            /go/src/github.com/buildkite/agent/vendor/golang.org/x/oauth2/google/default.go:72 +0x307 fp=0xc8204a7ac8 sp=0xc8204a7920\r\n    github.com/buildkite/agent/vendor/golang.org/x/oauth2/google.DefaultClient(0x7fc6d5d86658, 0xc8200114b8, 0xc8204a7c38, 0x1, 0x1, 0x0, 0x0, 0x0)\r\n            /go/src/github.com/buildkite/agent/vendor/golang.org/x/oauth2/google/default.go:34 +0x68 fp=0xc8204a7b38 sp=0xc8204a7ac8\r\n    github.com/buildkite/agent/agent.GSDownloader.Start(0xc8203de100, 0x3e, 0xc82011a460, 0x4, 0xc8202a44d0, 0x6d, 0x5, 0x0, 0x0, 0x0)\r\n            /go/src/github.com/buildkite/agent/agent/gs_downloader.go:32 +0xdf fp=0xc8204a7d30 sp=0xc8204a7b38\r\n    github.com/buildkite/agent/agent.(*ArtifactDownloader).Download.func1()\r\n            /go/src/github.com/buildkite/agent/agent/artifact_downloader.go:82 +0x692 fp=0xc8204a7f80 sp=0xc8204a7d30\r\n    github.com/buildkite/agent/pool.(*Pool).Spawn.func1(0xc8204344c0, 0xc8203de300)\r\n            /go/src/github.com/buildkite/agent/pool/pool.go:43 +0x44 fp=0xc8204a7fa0 sp=0xc8204a7f80\r\n    runtime.goexit()\r\n            /usr/local/go/src/runtime/asm_amd64.s:1998 +0x1 fp=0xc8204a7fa8 sp=0xc8204a7fa0\r\n    created by github.com/buildkite/agent/pool.(*Pool).Spawn\r\n            /go/src/github.com/buildkite/agent/pool/pool.go:44 +0x80\r\n\r\nAfter digging around, it seems the root cause is linking statically to glibc:\r\n\r\nhttps://sourceware.org/bugzilla/show_bug.cgi?id=19341\r\n\r\nSee also golang/go#13470 for more background. CockroachDB apparently works around this by linking dynamically to glibc per cockroachdb/cockroach#3392. And the glibc bug mentions that Docker also dynamically links glibc for this reason. I've also verified that linking dynamically fixes the problem in our environment.\r\n\r\nSo perhaps `scripts/utils/build-binary.sh` should be modified to only use `-ldflags \"-extldflags '-static'` when the platform is not `linux`."},"comment":{"url":"https://api.github.com/repos/buildkite/agent/issues/comments/240960166","html_url":"https://github.com/buildkite/agent/issues/370#issuecomment-240960166","issue_url":"https://api.github.com/repos/buildkite/agent/issues/370","id":240960166,"user":{"login":"toolmantim","id":153,"avatar_url":"https://avatars.githubusercontent.com/u/153?v=3","gravatar_id":"","url":"https://api.github.com/users/toolmantim","html_url":"https://github.com/toolmantim","followers_url":"https://api.github.com/users/toolmantim/followers","following_url":"https://api.github.com/users/toolmantim/following{/other_user}","gists_url":"https://api.github.com/users/toolmantim/gists{/gist_id}","starred_url":"https://api.github.com/users/toolmantim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/toolmantim/subscriptions","organizations_url":"https://api.github.com/users/toolmantim/orgs","repos_url":"https://api.github.com/users/toolmantim/repos","events_url":"https://api.github.com/users/toolmantim/events{/privacy}","received_events_url":"https://api.github.com/users/toolmantim/received_events","type":"User","site_admin":false},"created_at":"2016-08-19T08:32:30Z","updated_at":"2016-08-19T08:32:30Z","body":"So I think this is a good new default, we'll just need to publish a statically linked version against musl for environments that don't use libc"}}
{"actor":{"display_login":"toolmantim"}}