Skip to content
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

runtime: unoccurred deadlock in using cgo #16571

Closed
catalase opened this issue Aug 2, 2016 · 1 comment

Comments

Projects
None yet
3 participants
@catalase
Copy link

commented Aug 2, 2016

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

go version go1.6.2 windows/amd64

  1. What operating system and processor architecture are you using (go env)?
set GOARCH=amd64
set GOBIN=C:\Users\Home\go\bin
set GOEXE=.exe
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=C:\Users\Home\go
set GORACE=
set GOROOT=C:\go
set GOTOOLDIR=C:\go\pkg\tool\windows_amd64
set GO15VENDOREXPERIMENT=1
set CC=gcc
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0
set CXX=g++
set CGO_ENABLED=1
  1. What did you do?
    I ran the code.
package main

import "C"
import "fmt"

var _ C.int

func main() {
    fmt.Println("Jesus saves Go from deadlock")
    select {}
}
  1. What did you expect to see?
Jesus saves Go from deadlock
fatal error: all goroutines are asleep - deadlock!
...
  1. What did you see instead?
Jesus saves Go from deadlock
(the execution don't complete without any error message)

Seems that import C prevents the program from raising deadlock.

@bradfitz

This comment has been minimized.

Copy link
Member

commented Aug 2, 2016

Yes, this is known and unfortunate. See 34c67eb for some background.

/cc @dvyukov

@bradfitz bradfitz closed this Aug 2, 2016

@golang golang locked and limited conversation to collaborators Aug 2, 2017

@mikioh mikioh changed the title Go: unoccurred deadlock in using cgo runtime: unoccurred deadlock in using cgo Aug 3, 2017

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.