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

x/mobile/exp/audio/al: Crash when running al.CloseDevice() on OSX #17054

Open
emil10001 opened this Issue Sep 10, 2016 · 0 comments

Comments

Projects
None yet
3 participants
@emil10001
Copy link

emil10001 commented Sep 10, 2016

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

go version go1.7 darwin/amd64

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

Mac OS X 10.11.5

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/ejf3/workspace/gowork"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/zn/6y_5b8214sdg_1zzx907x3kh0000gn/T/go-build694490723=/tmp/go-build -gno-record-gcc-switches -fno-common"
CXX="clang++"
CGO_ENABLED="1"

What did you do?

import (
    "fmt"

    "golang.org/x/mobile/exp/audio/al"
)

func main() {
    fmt.Println("Hello, playground")

    err := al.OpenDevice()
    if err != nil {
        fmt.Println("failed to open device " + err.Error())
        return
    }
    defer al.CloseDevice()
}

The line defer al.CloseDevice() causes the crash. Removing that line allows the program to run without printing an error.

What did you expect to see?

I expected not to see a crash.

What did you see instead?

fatal error: unexpected signal during runtime execution
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x41f1927]

runtime stack:
runtime.throw(0x40ae810, 0x2a)
        /usr/local/go/src/runtime/panic.go:566 +0x95
runtime.sigpanic()
        /usr/local/go/src/runtime/sigpanic_unix.go:12 +0x2cc

goroutine 1 [syscall, locked to thread]:
runtime.cgocall(0x4080c00, 0xc420053e10, 0x0)
        /usr/local/go/src/runtime/cgocall.go:131 +0x110 fp=0xc420053de0 sp=0xc420053da0
golang.org/x/mobile/exp/audio/al._Cfunc_alcDestroyContext(0x19)
        golang.org/x/mobile/exp/audio/al/_obj/_cgo_gotypes.go:666 +0x41 fp=0xc420053e10 sp=0xc420053de0
golang.org/x/mobile/exp/audio/al.alcDestroyContext(0x19)
        /Users/ejf3/workspace/gowork/src/golang.org/x/mobile/exp/audio/al/alc_notandroid.go:61 +0x75 fp=0xc420053e58 sp=0xc420053e10
golang.org/x/mobile/exp/audio/al.CloseDevice()
        /Users/ejf3/workspace/gowork/src/golang.org/x/mobile/exp/audio/al/alc.go:70 +0xa9 fp=0xc420053e80 sp=0xc420053e58
main.main()
        /Users/ejf3/workspace/gowork/src/ejf.io/gosoundwave/noise/noise.go:29 +0x3c7 fp=0xc420053f48 sp=0xc420053e80
runtime.main()
        /usr/local/go/src/runtime/proc.go:183 +0x1f4 fp=0xc420053fa0 sp=0xc420053f48
runtime.goexit()
        /usr/local/go/src/runtime/asm_amd64.s:2086 +0x1 fp=0xc420053fa8 sp=0xc420053fa0

goroutine 17 [syscall, locked to thread]:
runtime.goexit()
        /usr/local/go/src/runtime/asm_amd64.s:2086 +0x1

This appears similar to the following two issues:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment