golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
124.33k stars 17.7k forks source link

x/sys/windows: TestAddRemoveDllDirectory failures #69029

Open gopherbot opened 3 months ago

gopherbot commented 3 months ago
#!watchflakes
default <- pkg == "golang.org/x/sys/windows" && test == "TestAddRemoveDllDirectory"

Issue created automatically to collect these failures.

Example (log):

=== RUN   TestAddRemoveDllDirectory
Exception 0xc0000005 0x0 0x1869b8f1000 0x7ffbf29e95c8
PC=0x7ffbf29e95c8

runtime.cgocall(0x7ff68c2657f0, 0x7ff68c580200)
    C:/Users/swarming/.swarming/w/ir/x/w/goroot/src/runtime/cgocall.go:157 +0x38 fp=0x400004fcf0 sp=0x400004fcb0 pc=0x7ff68c1f48a8
syscall.SyscallN(0x7ffbeee76910?, {0x400004fda0?, 0x3?, 0x1?})
    C:/Users/swarming/.swarming/w/ir/x/w/goroot/src/runtime/syscall_windows.go:544 +0xe8 fp=0x400004fd70 sp=0x400004fcf0 pc=0x7ff68c2616c8
syscall.Syscall(0x40000900f0?, 0xffffffffffffffff?, 0x7ff68c56fea0?, 0x1869b852460?, 0x0?)
    C:/Users/swarming/.swarming/w/ir/x/w/goroot/src/runtime/syscall_windows.go:482 +0x30 fp=0x400004fdc0 sp=0x400004fd70 pc=0x7ff68c2614b0
...
r24  0x77659ff7c8
r25  0x77659ffc48
r26  0x0
r27  0x77659ff7f0
r28  0x7ff68c57f580
r29  0x77659ff750
lr   0x7ffbf29e9580
sp   0x77659ff6c0
pc   0x7ffbf29e95c8
cpsr 0x20000000

watchflakes

gopherbot commented 3 months ago

Found new dashboard test flakes for:

#!watchflakes
default <- pkg == "golang.org/x/sys/windows" && test == "TestAddRemoveDllDirectory"
2024-08-22 21:00 x_sys-go1.22-windows-arm64 sys@a8c5219b release-branch.go1.22@e87be983 x/sys/windows.TestAddRemoveDllDirectory [ABORT] (log) === RUN TestAddRemoveDllDirectory Exception 0xc0000005 0x0 0x1869b8f1000 0x7ffbf29e95c8 PC=0x7ffbf29e95c8 runtime.cgocall(0x7ff68c2657f0, 0x7ff68c580200) C:/Users/swarming/.swarming/w/ir/x/w/goroot/src/runtime/cgocall.go:157 +0x38 fp=0x400004fcf0 sp=0x400004fcb0 pc=0x7ff68c1f48a8 syscall.SyscallN(0x7ffbeee76910?, {0x400004fda0?, 0x3?, 0x1?}) C:/Users/swarming/.swarming/w/ir/x/w/goroot/src/runtime/syscall_windows.go:544 +0xe8 fp=0x400004fd70 sp=0x400004fcf0 pc=0x7ff68c2616c8 syscall.Syscall(0x40000900f0?, 0xffffffffffffffff?, 0x7ff68c56fea0?, 0x1869b852460?, 0x0?) C:/Users/swarming/.swarming/w/ir/x/w/goroot/src/runtime/syscall_windows.go:482 +0x30 fp=0x400004fdc0 sp=0x400004fd70 pc=0x7ff68c2614b0 ... r24 0x77659ff7c8 r25 0x77659ffc48 r26 0x0 r27 0x77659ff7f0 r28 0x7ff68c57f580 r29 0x77659ff750 lr 0x7ffbf29e9580 sp 0x77659ff6c0 pc 0x7ffbf29e95c8 cpsr 0x20000000

watchflakes

leaanthony commented 3 months ago

We are seeing similar reports of Windows syscall.SyscallN failures that look like this in Wails with Go 1.23. Compiling on Go 1.22 works fine. Example stack trace:

Exception 0xc0000005 0x1 0x150 0x7ffcbd93823b
PC=0x7ffcbd93823b

runtime.cgocall(0xacfec0, 0x15716a8)
        ~/go/1.23/src/runtime/cgocall.go:167 +0x3e fp=0xc000206cb8 sp=0xc000206c50 pc=0xabff1e
syscall.SyscallN(0x0?, {0xc000206d00?, 0x0?, 0xc000206c8c?})
        ~/go/1.23/src/runtime/syscall_windows.go:519 +0x5d fp=0xc000206ce0 sp=0xc000206cb8 pc=0xaca5dd
syscall.Syscall(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
        ~/go/1.23/src/runtime/syscall_windows.go:458 +0x2f fp=0xc000206d28 sp=0xc000206ce0 pc=0xaca1af
github.com/wailsapp/wails/v2/internal/go-common-file-dialog/cfd.(*iUnknownVtbl).release(0x7ffcbd9b97b8, 0x1d7fb61ccd0)
        ~/go/pkg/mod/github.com/wailsapp/wails/v2@v2.9.1/internal/go-common-file-dialog/cfd/vtblCommonFunc.go:22 +0x5d fp=0xc000206dc8 sp=0xc000206d28 pc=0xff8c9d
github.com/wailsapp/wails/v2/internal/go-common-file-dialog/cfd.(*iFileOpenDialog).Release(0x1d7fb61ccd0)
        ~/go/pkg/mod/github.com/wailsapp/wails/v2@v2.9.1/internal/go-common-file-dialog/cfd/iFileOpenDialog.go:93 +0x34 fp=0xc000206e10 sp=0xc000206dc8 pc=0xff6634
github.com/wailsapp/wails/v2/internal/frontend/desktop/windows.(*Frontend).showCfdDialog.func1.1()
        ~/go/pkg/mod/github.com/wailsapp/wails/v2@v2.9.1/internal/frontend/desktop/windows/dialog.go:146 +0x2c fp=0xc000206e60 sp=0xc000206e10 pc=0x109f8ac
runtime.deferreturn()
        ~/go/1.23/src/runtime/panic.go:605 +0x5e fp=0xc000206ef0 sp=0xc000206e60 pc=0xa8febe
github.com/wailsapp/wails/v2/internal/frontend/desktop/windows.(*Frontend).showCfdDialog.func1()
        ~/go/pkg/mod/github.com/wailsapp/wails/v2@v2.9.1/internal/frontend/desktop/windows/dialog.go:156 +0x4e9 fp=0xc0002070e0 sp=0xc000206ef0 pc=0x109f829
github.com/wailsapp/wails/v2/internal/frontend/desktop/windows.invokeSync[...].func1()
        ~/go/pkg/mod/github.com/wailsapp/wails/v2@v2.9.1/internal/frontend/desktop/windows/window.go:331 +0x55 fp=0xc000207160 sp=0xc0002070e0 pc=0x10ae175
github.com/wailsapp/wails/v2/internal/frontend/desktop/windows/winc.(*ControlBase).invokeCallbacks(0xc000086c40)
        ~/go/pkg/mod/github.com/wailsapp/wails/v2@v2.9.1/internal/frontend/desktop/windows/winc/controlbase.go:550 +0x2f3 fp=0xc0002072b8 sp=0xc000207160 pc=0xfe29f3
github.com/wailsapp/wails/v2/internal/frontend/desktop/windows.(*Window).github.com/wailsapp/wails/v2/internal/frontend/desktop/windows/winc.invokeCallbacks(0xc000086c40)
        <autogenerated>:1 +0x28 fp=0xc0002072d8 sp=0xc0002072b8 pc=0x10b06a8
github.com/wailsapp/wails/v2/internal/frontend/desktop/windows/winc.generalWndProc(0x702a4, 0xc240, 0x0, 0x0)
        ~/go/pkg/mod/github.com/wailsapp/wails/v2@v2.9.1/internal/frontend/desktop/windows/winc/wndproc.go:148 +0xf47 fp=0xc0002074c8 sp=0xc0002072d8 pc=0xfe97a7
runtime.call32(0x0, 0x12111c0, 0xc000207528, 0x0, 0x0, 0x20, 0xc000207760)
        ~/go/1.23/src/runtime/asm_amd64.s:776 +0x48 fp=0xc0002074f8 sp=0xc0002074c8 pc=0xaccc88
runtime.callbackWrap(0x7d1c3ff4e0)
        ~/go/1.23/src/runtime/syscall_windows.go:396 +0x266 fp=0xc0002078e8 sp=0xc0002074f8 pc=0xaaee86
runtime.cgocallbackg1(0xaaec20, 0x7d1c3ff4e0, 0x0)
        ~/go/1.23/src/runtime/cgocall.go:437 +0x234 fp=0xc0002079a0 sp=0xc0002078e8 pc=0xa5a274
runtime.cgocallbackg(0xaaec20, 0x7d1c3ff4e0, 0x0)
        ~/go/1.23/src/runtime/cgocall.go:356 +0x127 fp=0xc000207a20 sp=0xc0002079a0 pc=0xa59f87
runtime.cgocallbackg(0xaaec20, 0x7d1c3ff4e0, 0x0)
        <autogenerated>:1 +0x2e fp=0xc000207a48 sp=0xc000207a20 pc=0xad44ae
runtime.cgocallback(0xc000207ad8, 0xabff52, 0xacfec0)
        ~/go/1.23/src/runtime/asm_amd64.s:1084 +0xec fp=0xc000207a70 sp=0xc000207a48 pc=0xace48c
runtime.systemstack_switch()
        ~/go/1.23/src/runtime/asm_amd64.s:479 +0x8 fp=0xc000207a80 sp=0xc000207a70 pc=0xacc6c8
runtime.cgocall(0xacfec0, 0x15716a8)
        ~/go/1.23/src/runtime/cgocall.go:185 +0x72 fp=0xc000207ae8 sp=0xc000207a80 pc=0xabff52
syscall.SyscallN(0xc000089180?, {0xc00000a8b8?, 0x3f004002000000?, 0xc000207b60?})
        ~/go/1.23/src/runtime/syscall_windows.go:519 +0x5d fp=0xc000207b10 sp=0xc000207ae8 pc=0xaca5dd
syscall.(*Proc).Call(0xc000089180, {0xc00000a8b8, 0x1, 0x1})
        ~/go/1.23/src/syscall/dll_windows.go:166 +0x7e fp=0xc000207ba0 sp=0xc000207b10 pc=0xaf475e
syscall.(*LazyProc).Call(0xc0001465d0, {0xc00000a8b8, 0x1, 0x1})
        ~/go/1.23/src/syscall/dll_windows.go:286 +0x95 fp=0xc000207c38 sp=0xc000207ba0 pc=0xaf5175
github.com/wailsapp/wails/v2/internal/frontend/desktop/windows/winc/w32.DispatchMessage(0x1d7fb5c91c0)
        ~/go/pkg/mod/github.com/wailsapp/wails/v2@v2.9.1/internal/frontend/desktop/windows/winc/w32/user32.go:364 +0x8f fp=0xc000207ce0 sp=0xc000207c38 pc=0xfd7daf
github.com/wailsapp/wails/v2/internal/frontend/desktop/windows/winc.RunMainLoop()
        ~/go/pkg/mod/github.com/wailsapp/wails/v2@v2.9.1/internal/frontend/desktop/windows/winc/app.go:84 +0x107 fp=0xc000207d80 sp=0xc000207ce0 pc=0xfdd887
github.com/wailsapp/wails/v2/internal/frontend/desktop/windows.(*Frontend).RunMainLoop(0xc000220000)
        ~/go/pkg/mod/github.com/wailsapp/wails/v2@v2.9.1/internal/frontend/desktop/windows/frontend.go:212 +0x14 fp=0xc000207d90 sp=0xc000207d80 pc=0x10a1c34
github.com/wailsapp/wails/v2/internal/app.(*App).Run(0xc0000fa1e0)
        ~/go/pkg/mod/github.com/wailsapp/wails/v2@v2.9.1/internal/app/app_production.go:19 +0x72 fp=0xc000207df8 sp=0xc000207d90 pc=0x10b9212
github.com/wailsapp/wails/v2/pkg/application.(*Application).Run(0xc000122820)
        ~/go/pkg/mod/github.com/wailsapp/wails/v2@v2.9.1/pkg/application/application.go:73 +0x18f fp=0xc000207e88 sp=0xc000207df8 pc=0x10bb10f
github.com/wailsapp/wails/v2.Run(0xc00020e000)
        ~/go/pkg/mod/github.com/wailsapp/wails/v2@v2.9.1/wails.go:14 +0x2f fp=0xc000207ec8 sp=0xc000207e88 pc=0x10bb54f
main.main()
        ~/Projects/del/testwails3/testdlg/main.go:19 +0x359 fp=0xc000207f78 sp=0xc000207ec8 pc=0x10bbb59
runtime.main()
        ~/go/1.23/src/runtime/proc.go:272 +0x227 fp=0xc000207fe0 sp=0xc000207f78 pc=0xa93be7
runtime.goexit({})
        ~/go/1.23/src/runtime/asm_amd64.s:1700 +0x1 fp=0xc000207fe8 sp=0xc000207fe0 pc=0xace6e1

Again, the code works perfectly fine when compiled using Go 1.22.X

qmuntal commented 3 months ago

Not sure it is the same issue @leaanthony. This trace, extracted from the provided logs, seems suspisious: syscall.Syscall(0x0?, 0x0?, 0x0?, 0x0?, 0x0?). You are calling syscall.Syscall with the nargs parameter set to 0, which means there are no parameters. But, looking at the source code, it looks like you meant to pass at least one.

This regression you are seeing when using go1.23 is probably related to CL 563315, which optimized the syscall.Syscall performance and reduced the stack usage by using the nargs parameter, which was previously ignored.

I'm inclined to say that this is not a go1.23 regression, although it can break syscall.Syscall callers that are not correctly setting the nargs parameter. I would recommend to switch to the less error prone syscall.SyscallN function.

@golang/windows @golang/release

leaanthony commented 3 months ago

I really appreciate the time you took to respond 🙏 I've looked at replacing syscall with syscallN and indeed it does seem to have addressed the issue. I did not know about that change and didn't find it in the release notes so I appreciate the link. Thank you 🙏

dr2chase commented 3 months ago

Provisionally assigned to @qmuntal, not clear if this is a problem at tip or not.

gopherbot commented 2 months ago

Found new dashboard test flakes for:

#!watchflakes
default <- pkg == "golang.org/x/sys/windows" && test == "TestAddRemoveDllDirectory"
2024-09-04 13:19 x_sys-go1.23-windows-arm64 sys@a43b625d release-branch.go1.23@80ff7cd3 x/sys/windows.TestAddRemoveDllDirectory [ABORT] (log) === RUN TestAddRemoveDllDirectory Exception 0xc0000005 0x0 0x217d90f1000 0x7ff9916895c8 PC=0x7ff9916895c8 runtime.cgocall(0x7ff6edce9da0, 0x7ff6ee03a848) C:/Users/swarming/.swarming/w/ir/x/w/goroot/src/runtime/cgocall.go:167 +0x38 fp=0x40002a1d50 sp=0x40002a1ce0 pc=0x7ff6edcda988 syscall.SyscallN(0x7?, {0x40002a1da0?, 0x0?, 0x1?}) C:/Users/swarming/.swarming/w/ir/x/w/goroot/src/runtime/syscall_windows.go:519 +0x48 fp=0x40002a1d70 sp=0x40002a1d50 pc=0x7ff6edce4d68 syscall.Syscall(0x40000106f0?, 0xffffffffffffffff?, 0x7ff6ee02a0c0?, 0x217d90a1b40?, 0x0?) C:/Users/swarming/.swarming/w/ir/x/w/goroot/src/runtime/syscall_windows.go:458 +0x30 fp=0x40002a1dc0 sp=0x40002a1d70 pc=0x7ff6edce4b70 ... r24 0x83267ff968 r25 0x83267ffde8 r26 0x0 r27 0x83267ff990 r28 0x7ff6ee039ca0 r29 0x83267ff8f0 lr 0x7ff991689580 sp 0x83267ff860 pc 0x7ff9916895c8 cpsr 0x20000000

watchflakes

gopherbot commented 2 weeks ago

Found new dashboard test flakes for:

#!watchflakes
default <- pkg == "golang.org/x/sys/windows" && test == "TestAddRemoveDllDirectory"
2024-11-12 17:28 x_sys-gotip-windows-arm64 sys@a13946c6 go@ab554650 x/sys/windows.TestAddRemoveDllDirectory [ABORT] (log) === RUN TestAddRemoveDllDirectory Exception 0xc0000005 0x0 0x233144e9000 0x7ffb4e4295c8 PC=0x7ffb4e4295c8 runtime.cgocall(0x7ff72ccb3980, 0x4000080348) C:/Users/swarming/.swarming/w/ir/x/w/goroot/src/runtime/cgocall.go:167 +0x38 fp=0x4000043d50 sp=0x4000043ce0 pc=0x7ff72cca89c8 runtime.syscall_syscalln(0x7?, 0x0?, {0x4000043da0?, 0x1?, 0x40000118d8?}) C:/Users/swarming/.swarming/w/ir/x/w/goroot/src/runtime/syscall_windows.go:521 +0x4c fp=0x4000043d70 sp=0x4000043d50 pc=0x7ff72cc9652c syscall.Syscall(0x40000118d8?, 0xffffffffffffffff?, 0x7ff72cff6ba0?, 0x2331442f3b0?, 0x0?) C:/Users/swarming/.swarming/w/ir/x/w/goroot/src/runtime/syscall_windows.go:457 +0x28 fp=0x4000043dc0 sp=0x4000043d70 pc=0x7ff72ccaed18 ... r24 0xa896bff178 r25 0xa896bff5f8 r26 0x0 r27 0xa896bff1a0 r28 0x4000086000 r29 0xa896bff100 lr 0x7ffb4e429580 sp 0xa896bff070 pc 0x7ffb4e4295c8 cpsr 0x20000000

watchflakes