Skip to content

runtime: send on channel panics with "unexpected signal during runtime execution" #19468

Closed
@mappu

Description

@mappu

What version of Go are you using (go version)?

go version go1.8 windows/amd64
x86_64-w64-mingw32-gcc (GCC) 5.4.0

What operating system and processor architecture are you using (go env)?

set GOARCH=amd64
set GOBIN=
set GOEXE=.exe
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=C:\repos\winio-zstd-panic-clone
set GORACE=
set GOROOT=C:\Go
set GOTOOLDIR=C:\Go\pkg\tool\windows_amd64
set GCCGO=gccgo
set CC=gcc
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 -fdebug-prefix-map=C:\cygwin\tmp\go-build164083627=/tmp/go-build -gno-record-gcc-switches
set CXX=g++
set CGO_ENABLED=1
set PKG_CONFIG=pkg-config
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2

What did you do?

  1. Have a working Go + CGO environment on Windows (here i use mingw-w64).

  2. Install test case: go get github.com/mappu/winio-zstd-panic/src/winio-zstd-panic

  3. Run a few times: $GOPATH/bin/winio-zstd-panic - the bug happens maybe 1/10 executions on my machine (Intel i5 6400).

What did you expect to see?

******************************
client: making connection...

client: connected

server: recieved signal, shutting down

What did you see instead?

******************************
client: making connection...
fatal error:
client: connected
unexpected signal during runtime execution
[signal 0xc0000005 code=0x0 addr=0xffffffffffffffff pc=0x40e395]

goroutine 18 [running]:
runtime.throw(0x4fd587, 0x2a)
        C:/Go/src/runtime/panic.go:596 +0x9c fp=0xc042083e08 sp=0xc042083de8
runtime.sigpanic()
        C:/Go/src/runtime/signal_windows.go:155 +0x18b fp=0xc042083e38 sp=0xc042083e08
runtime.lock(0x24749f73771afe8f)
        C:/Go/src/runtime/lock_sema.go:43 +0x65 fp=0xc042083e70 sp=0xc042083e38
runtime.chansend(0x4cf380, 0x24749f73771afe37, 0xc042083fb0, 0xc042083f01, 0x4b64fa, 0xc042083f9c)
        C:/Go/src/runtime/chan.go:176 +0xba fp=0xc042083f20 sp=0xc042083e70
runtime.chansend1(0x4cf380, 0x24749f73771afe37, 0xc042083fb0)
        C:/Go/src/runtime/chan.go:113 +0x4d fp=0xc042083f60 sp=0xc042083f20
github.com/Microsoft/go-winio.ioCompletionProcessor(0x1c8)
        C:/repos/winio-zstd-panic/src/github.com/Microsoft/go-winio/file.go:133 +0xea fp=0xc042083fd8 sp=0xc042083f60
runtime.goexit()
        C:/Go/src/runtime/asm_amd64.s:2197 +0x1 fp=0xc042083fe0 sp=0xc042083fd8
created by github.com/Microsoft/go-winio.initIo
        C:/repos/winio-zstd-panic/src/github.com/Microsoft/go-winio/file.go:57 +0x87

goroutine 1 [runnable]:
main.main()
        C:/repos/winio-zstd-panic/src/github.com/mappu/winio-zstd-panic/src/winio-zstd-panic/main.go:112 +0xcd

goroutine 17 [syscall, locked to thread]:
runtime.goexit()
        C:/Go/src/runtime/asm_amd64.s:2197 +0x1

goroutine 5 [select]:
github.com/Microsoft/go-winio.(*win32PipeListener).listenerRoutine(0xc042030070)
        C:/repos/winio-zstd-panic/src/github.com/Microsoft/go-winio/pipe.go:269 +0x4e9
created by github.com/Microsoft/go-winio.ListenPipe
        C:/repos/winio-zstd-panic/src/github.com/Microsoft/go-winio/pipe.go:352 +0x2ec

goroutine 6 [chan receive]:
github.com/Microsoft/go-winio.(*win32PipeListener).Accept(0xc042030070, 0x0, 0x0, 0x0, 0x0)
        C:/repos/winio-zstd-panic/src/github.com/Microsoft/go-winio/pipe.go:373 +0x120
main.(*Terminator).worker(0xc04200c400)
        C:/repos/winio-zstd-panic/src/github.com/mappu/winio-zstd-panic/src/winio-zstd-panic/main.go:39 +0x3a
created by main.NewTerminator
        C:/repos/winio-zstd-panic/src/github.com/mappu/winio-zstd-panic/src/winio-zstd-panic/main.go:34 +0x141

goroutine 19 [chan receive]:
github.com/Microsoft/go-winio.(*win32File).asyncIo(0xc042074050, 0xc042078060, 0x0, 0xc000000000, 0x0, 0x0, 0x5bc4a0, 0xc042088000, 0x0, 0x0, ...)
        C:/repos/winio-zstd-panic/src/github.com/Microsoft/go-winio/file.go:167 +0x24d
github.com/Microsoft/go-winio.connectPipe(0xc042074050, 0x0, 0x0)
        C:/repos/winio-zstd-panic/src/github.com/Microsoft/go-winio/pipe.go:362 +0xc1
github.com/Microsoft/go-winio.(*win32PipeListener).listenerRoutine.func1(0xc042072060, 0xc042076000)
        C:/repos/winio-zstd-panic/src/github.com/Microsoft/go-winio/pipe.go:267 +0x35
created by github.com/Microsoft/go-winio.(*win32PipeListener).listenerRoutine
        C:/repos/winio-zstd-panic/src/github.com/Microsoft/go-winio/pipe.go:268 +0x286

goroutine 20 [runnable, locked to thread]:
syscall.Syscall(0x7ffb78294620, 0x1, 0x1cc, 0x0, 0x0, 0xc04216e080, 0xc042019900, 0x2)
        C:/Go/src/runtime/syscall_windows.go:163 +0x6b
syscall.GetFileType(0x1cc, 0x428ea5, 0xc000000008, 0xc04216e080)
        C:/Go/src/syscall/zsyscall_windows.go:756 +0x6b
syscall.Seek(0x1cc, 0x0, 0x1, 0x1001, 0x101000000001000, 0x0)
        C:/Go/src/syscall/syscall_windows.go:349 +0x57
os.(*File).pread(0xc042076008, 0xc042280000, 0x1000, 0x1000, 0x0, 0x0, 0x0, 0x0)
        C:/Go/src/os/file_windows.go:298 +0xc8
os.(*File).ReadAt(0xc042076008, 0xc042280000, 0x1000, 0x1000, 0x0, 0x1000, 0xc042276c00, 0x929)
        C:/Go/src/os/file.go:120 +0xba
main.start_workload_simulator.func1(0xc042072120)
        C:/repos/winio-zstd-panic/src/github.com/mappu/winio-zstd-panic/src/winio-zstd-panic/main.go:78 +0x10e
created by main.start_workload_simulator
        C:/repos/winio-zstd-panic/src/github.com/mappu/winio-zstd-panic/src/winio-zstd-panic/main.go:93 +0x46

This test case creates a win32 named pipe; performs some background work; and then connects to the named pipe. But for some reason, connecting to the named pipe causes a panic within Golang's channel / signal handling.

This test case depends on both (A) a third-party Windows library, and (B) a third-party CGO library. I did report this issue to the vendor of A as microsoft/go-winio#41 but, the more i look at the panic trace, i think the issue is with Golang's runtime (apologies in advance if that's wrong).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions