Skip to content

os/exec: fatal error: runtime·unlock: lock count #30594

@yinjun622

Description

@yinjun622

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

$ go version
go version go1.12 darwin/amd64

Does this issue reproduce with the latest release?

yes

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

go env Output
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/leeleon/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/leeleon/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/Cellar/go/1.12/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.12/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/leeleon/go/src/test_aos9/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/df/tbfwxrg54g98zctp_hjz0l1r0000gn/T/go-build076111302=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

func main() {
	for {
		for i:=0;i<20;i++{
			go func() {
				ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
				defer cancel()
				cmd := exec.CommandContext(ctx,"ls")
				stdout, err := cmd.StdoutPipe()
				cmd.Start()
				content, err := ioutil.ReadAll(stdout)
				if err != nil {
					fmt.Println(err)
				}
				err = cmd.Wait()
				if err != nil {
					fmt.Println(err)
				}
				fmt.Println(string(content))
			}()
		}
		time.Sleep(time.Second*1)
	}
}
  • build the code on Mac:
    ~CGO_ENABLED=0 GOOS=linux GOARCH=arm go build

  • run the code at android phone(sony SO-01L aos9)

~uname -a
Linux localhost 4.9.112-perf+ #1 SMP PREEMPT Fri Dec 14 00:09:44 2018 aarch64
  • err log:
fatal error: runtime·unlock: lock count
fatal: morestack on g0
SIGSEGV: segmentation violation
PC=0x64014 m=1 sigcode=1

goroutine 0 [idle]:
runtime.abort()
	/usr/local/Cellar/go/1.12/libexec/src/runtime/asm_arm.s:801 +0x4
runtime.badmorestackg0()
	/usr/local/Cellar/go/1.12/libexec/src/runtime/proc.go:435 +0x2c
runtime: unexpected return pc for runtime.printstring called from 0x18fc6c
stack: frame={sp:0x203e36c, fp:0x203e390} stack=[0x203e000,0x2040000)
0203e2ec:  00000000  00000000  00000000  00000000
0203e2fc:  00000000  00000000  00000000  00000000

err.log

What did you expect to see?

The problem is similar like #29173.

How can it be solved?

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions