-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
race: not working with Alpine based image #14481
Comments
CC @dvyukov As far as I know this is because race.syso assumes a glibc based system. I don't know that there is a simple fix here. |
I can't think of any simple fix. A complex fix would be to remove all dependencies on libc from race runtime (there is an open issue for that). |
hi, all, just wondering. does anyone have a complete working example of a golang program working with out of interest, are the flags not tested? i would imagine that this sort of issue would be picked up at compile time, unless the Alpine-based is configured to to include it... no idea, just guessing. anywho, working sample would be much appreciated. |
I have managed to build a race_linux_amd64.syso that works on Alpine. Here are the necessary changes: neelance/compiler-rt@32aa655 I haven't verified that it still works on other Linux platforms. To build on Alpine:
I'm not sure how to continue from here. Any suggestions on getting that upstream? |
Here are instructions on how to contribute to sanitizers: I skimmed through your patch and I think we can upstream something like this. But we need some testing story, otherwise it will break in future. One good test might be to whitelist all libc symbol dependencies in buildgo.sh. This way we can ensure that we won't silently add a new dependency (ideally in future this list becomes empty). |
@dvyukov I see that you did most of the updates of the syso files. I have some more questions:
|
I now use
You need to either run your own Go builder and connect it to dashboard, or we need to setup Alpine linux builder on GCE. @bradfitz, do we want to setup/maintain it?
It's possible. Does removing |
We now have Alpine builders, so in theory For now I'm just going to be skipping race tests on Alpine so we don't regress on other things. |
CL https://golang.org/cl/41678 mentions this issue. |
…s on Alpine In an effort to at least understand the complete set of things not working on Alpine Linux, I've been trying to get the build passing again, even with tests disabled. The race detector is broken on Alpine. That is #14481 (and #9918). So disable those tests for now. Also, internal linking with PIE doesn't work on Alpine yet. That is #18243. So disable that test for now. With this CL, all.bash almost passes. There's some cgo test failing still, but there's no bug yet, so that can be a separate CL. Change-Id: I3ffbb0e787ed54cb82f298b6bd5bf3ccfbc82622 Reviewed-on: https://go-review.googlesource.com/41678 Run-TryBot: Brad Fitzpatrick <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]>
The race detector doesn't work without glibc due to golang/go#14481. Fixes cockroachdb#15378.
golang/go#14481 Signed-off-by: Akihiro Suda <[email protected]>
Enable the Go race detector to help surface race conditions when running the tests. The race detector currently depends on libc, so does not work with Alpine Linux (which uses musl): golang/go#9918 golang/go#14481 Instead, use the default Go Docker image, which uses the libc-based Debian Jessie and update the Dockerfiles accordingly.
Humm... yes, it seems this bit of code may actually be needed:
Pulling in ReExec may transitively pull in lots of other other things (as you noted already). Maybe we could do what freebsd does above if SANITIZER_GO to at least warn users:
But I don't know if users can actually turn ASLR off if needed. Potentially ASLR does not affect static Go binaries at all (?). But maybe it's a problem with cgo. Hard to say what's best without testing... |
Yes, that's what I thought as well. |
What is the next-gen algorithm? |
It's not described anywhere. |
Change https://golang.org/cl/227867 mentions this issue: |
Hello all, a big thank you first of all for the work fixing this issue. Do you have an approximate time when the Go Docker image will contain the fix? I just tried Or, if it will take quite some time, is there a way for us to manually build and bundle something in the docker image to have it fixed using your latest changes? |
@qdm12 this was merged in master, so it will be part of the upcoming Go 1.15 release due in July, unless it gets reverted. Only important bug fixes are generally backported to stable Go releases. See https://github.com/golang/go/wiki/MinorReleases. In particular, while this change is awesome and I'd also like to use it today, the change is probably too invasive and risky to backport to a release like 1.14.3. The first 1.15 beta should be out in just six weeks, so you could try the docker images that come out with that release, too. |
@qdm12 We are using
and then copy it over the original one
Or you can just wait for the 1.15 :) |
Okay thanks for letting us know 👍 I noticed there is a |
Change https://golang.org/cl/231222 mentions this issue: |
Update race detector syso files for some platforms. There's still 2 more to do, but they might take a while so I'm mailing the ones I have now. Note: some arm64 tests did not complete successfully due to out of memory errors, but I suspect the .syso is correct. For #14481 For #37485 (I think?) For #37355 Fixes #38321 Change-Id: I7e7e707a1fd7574855a538ba89dc11acc999c760 Reviewed-on: https://go-review.googlesource.com/c/go/+/226981 Run-TryBot: Ian Lance Taylor <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]> (cherry picked from commit 041bcb3) Reviewed-on: https://go-review.googlesource.com/c/go/+/231222 Reviewed-by: Keith Randall <[email protected]>
Change https://golang.org/cl/232417 mentions this issue: |
For #14481 For #37355 For #38321 Change-Id: Idfceaf0e64d340b7304ce9562549a82ebfc27e3c Reviewed-on: https://go-review.googlesource.com/c/go/+/227867 Run-TryBot: Keith Randall <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Dmitry Vyukov <[email protected]> (cherry picked from commit 3afa741) Reviewed-on: https://go-review.googlesource.com/c/go/+/232417 Run-TryBot: Ian Lance Taylor <[email protected]> Reviewed-by: Keith Randall <[email protected]>
Is this confirmed working in golang 1.15? I don't see anything in the release notes, and my google search didn't turn up anything helpful. Thanks! |
Yes, we are using it successfully with the (rolling) 1.15-alpine tag. |
I can confirm it works on Good job! |
Doesn't work for me. But I added
to make it work. Seems similar to this gist: https://gist.github.com/miry/fece267c7faba904c360 If you also need git you can use instead:
|
tsan while used by golang's race detector was not working on alpine linux, since it is using musl-c instead of glibc. Since alpine is very popular distribution for container deployments, having working race detector would be nice. This commits adds some ifdefs to get it working. It fixes golang/go#14481 on golang's issue tracker. Reviewed-in: https://reviews.llvm.org/D75849 Author: graywolf-at-work (Tomas Volf)
Hi,
With the following docker image (save it as demo.docker)
run
docker build -f demo.docker -t race/demo .
Then you can finally run the command:
This will fail with:
If you then disable CGO and run again:
It will result in the following output:
Previously, in go 1.5.3, when running with CGO disabled, this used to fail with:
To test this just change the base image for the container.
Please let me know if there are any additional details I can share.
Thank you.
The text was updated successfully, but these errors were encountered: