microsoft / go

The Microsoft build of the Go toolset
BSD 3-Clause "New" or "Revised" License
259 stars 23 forks source link

Test failure: TestCallbackCallersSEH gets incomplete trace on Windows CI with MinGW 12.2.0-rt_v10-rev2 #1093

Open dagood opened 7 months ago

dagood commented 7 months ago

https://dev.azure.com/dnceng-public/public/_build/results?buildId=501610&view=results

--- FAIL: TestCallbackCallersSEH (0.00s)
    callback_windows.go:86: got 4
2023/12/15 23:30:18 Failed: exit status 1
    callback_windows.go:93: 0 _cgo_a35112bc76e5_Cfunc_backtrace
    callback_windows.go:93: 1 runtime.asmcgocall_landingpad
    callback_windows.go:93: 2 runtime.asmcgocall
    callback_windows.go:93: 3 runtime.cgocall
    callback_windows.go:109: incorrect backtrace:
        want:   [test._Cfunc_backtrace test.testCallbackCallersSEH.func1.1 test.testCallbackCallersSEH.func1 test.goCallback test._Cfunc_callback test.nestedCall.func1 test.nestedCall test.testCallbackCallersSEH test.TestCallbackCallersSEH]
        got:    []
FAIL
scatter = 00000000005C24C0
sqrt is: 0
hello from C
FAIL    cmd/cgo/internal/test   0.930s
FAIL

(I added extra logging to figure out what was being filtered down to nothing.)

This is a run of https://github.com/microsoft/go/tree/0f3f286654f58ead223d9cb04c828cf4761d2456

Originally spotted in an upstream sync PR.

Using https://github.com/microsoft/go-infra/pull/95, this runs the test under the same MinGW:

getmingw run -source nixman -version 12.2.0-rt_v10-rev2 -arch x86_64 -threading posix -exception seh -runtime ucrt -- bin\go test cmd/cgo/internal/test -run CallersSEH -count 1 -v

Updating CI from 12.2.0-rt_v10-rev2 to 13.2.0-rt_v11-rev0 makes this test pass.

qmuntal commented 6 months ago

Manage to reproduce this locally by running:

getmingw run -source nixman -version 12.2.0-rt_v10-rev2 -arch x86_64 -threading posix -exception seh -runtime ucrt -- go test ./cmd/cgo/internal/test -run CallersSEH -count 1 -ldflags=-linkmode=internal -v

(Notice that I added the -ldflags=-linkmode=internal flag)

qmuntal commented 6 months ago

Found the root cause and filed an upstream issue with a bug report: https://github.com/golang/go/issues/65116. Not an easy fix, it will have to be done in go1.23.

qmuntal commented 6 months ago

Submitted https://go-review.googlesource.com/c/go/+/556635 to skip it for now when using internal linking.