frankenphp icon indicating copy to clipboard operation
frankenphp copied to clipboard

PIE mode tests with fibers

Open withinboredom opened this issue 1 year ago • 5 comments

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 avatar Dec 14 '23 18:12 withinboredom

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 avatar Dec 14 '23 18:12 withinboredom

oh wait, these tests are different.

withinboredom avatar Dec 14 '23 18:12 withinboredom

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

withinboredom avatar Dec 14 '23 20:12 withinboredom

It looks like it still fails on Debian too.

dunglas avatar Dec 14 '23 20:12 dunglas

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.

withinboredom avatar Dec 15 '23 11:12 withinboredom