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

PIE mode tests with fibers #387

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

PIE mode tests with fibers #387

wants to merge 4 commits into from

Conversation

withinboredom
Copy link
Collaborator

@withinboredom withinboredom commented Dec 14, 2023

Running CGO_CXXFLAGS=-fPIE CGO_CFLAGS=-fPIE CGO_LDFLAGS=-pie go test -buildmode=pie -v ./... (-race is not compatible with pie) appears to be passing tests on x64 (local). Opening this PR to have it test all other architectures as well.

I have no idea why this works and it might be an excellent question for golang/go/#62130 to see if it is actually working or just pretending to work by somehow making a larger stack that just so happens to pass the test.

Continuation of #99, #171. Closes #46, closes #99, closes #171.

@withinboredom
Copy link
Collaborator Author

huh, interesting... I cannot reproduce this.

go clean -testcache
CGO_CXXFLAGS=-fPIE CGO_CFLAGS=-fPIE CGO_LDFLAGS=-pie go test -buildmode=pie -v ./...
# goto 0

haven't gotten a single failure.

\o/ I got nothin.

@withinboredom
Copy link
Collaborator Author

oh wait, these tests are different.

@withinboredom
Copy link
Collaborator Author

Looks like this might be a good work-around for non-alpine 8.3 builds.

@dunglas
Copy link
Owner

dunglas commented Dec 14, 2023

It looks like it still fails on Debian too.

@@ -48,11 +48,11 @@ jobs:
run: go build
-
name: Run library tests
run: go test -race -v ./...
run: CGO_CXXFLAGS=-fPIE CGO_CFLAGS=-fPIE CGO_LDFLAGS=-pie go test -buildmode=pie -v ./...
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to preserve the previous values of these env vars (set line 37). Same in the Docker images.

@withinboredom
Copy link
Collaborator Author

It looks like this way of linking just so happens to lay out the memory in such a way that sometimes (if not most of the time), the fiber stack stays within the bounds of Go's stack. So, instead of a guaranteed explosion, you just randomly get explosions.

In practice, I'm not seeing any explosions, but I think the tests sometimes passing/failing illustrates that the possibility is there.

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

Successfully merging this pull request may close these issues.

Using Fibers causes epic crash
2 participants