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: os/exec fatal error: all goroutines are asleep - deadlock! on mips64 #42825

jgbooks opened this issue Nov 25, 2020 · 6 comments


Copy link

@jgbooks jgbooks commented Nov 25, 2020

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

$ go version
>go version go1.15.1 

Does this issue reproduce with the latest release?

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

go env Output
$ go env
running env
Kernel version:4.4.131
Architecture:          mips64
Byte Order:            Little Endian
CPU(s):                4
On-line CPU(s) list:   0-3

What did you do?

package main

import (

// Check root rights to use system service
func checkPrivileges() (bool) {
	if output, err := exec.Command("id", "-g").Output(); err == nil {
		if gid, parseErr := strconv.ParseUint(strings.TrimSpace(string(output)), 10, 32); parseErr == nil {
			if gid == 0 {
				return true
			return false
	} else {
		// TODO: This is not true for user services.
		return os.Getppid() != 1
	return false

func main(){

CGO_ENABLED=0 GOARCH=mips64le GOMIPS=softfloat GOOS=linux go build command.go

What did you expect to see?

What did you see instead?

fatal error: all goroutines are asleep - deadlock!

goroutine 1 [chan receive]:
os/exec.(*Cmd).Wait(0xc0000c4000, 0x0, 0x0)
	/usr/local/go/src/os/exec/exec.go:515 +0x128
os/exec.(*Cmd).Run(0xc0000c4000, 0xc0000c2050, 0x0)
	/usr/local/go/src/os/exec/exec.go:341 +0x74
os/exec.(*Cmd).Output(0xc0000c4000, 0x2, 0xc0000a0f58, 0x1, 0x1, 0xc0000c4000)
	/usr/local/go/src/os/exec/exec.go:546 +0xa4
	/root/client/debug/command.go:14 +0x8c
	/root/client/debug/command.go:30 +0x54

goroutine 19 [IO wait]:
internal/poll.runtime_pollWait(0xffca558d28, 0x72, 0x118420)
	/usr/local/go/src/runtime/netpoll.go:220 +0x60
internal/poll.(*pollDesc).wait(0xc0000be258, 0x72, 0xc000058001, 0x8000, 0x8000)
	/usr/local/go/src/internal/poll/fd_poll_runtime.go:87 +0x50
internal/poll.(*FD).Read(0xc0000be240, 0xc000058000, 0x8000, 0x8000, 0x0, 0x0, 0x0)
	/usr/local/go/src/internal/poll/fd_unix.go:159 +0x1c4
os.(*File).Read(0xc0000bc038, 0xc000058000, 0x8000, 0x8000, 0x0, 0x0, 0x0)
	/usr/local/go/src/os/file.go:116 +0x7c
io.copyBuffer(0x1183a0, 0xc0000c2050, 0x1182e0, 0xc0000bc038, 0xc000058000, 0x8000, 0x8000, 0x0, 0x0, 0x0)
	/usr/local/go/src/io/io.go:409 +0x108
os/exec.(*Cmd).writerDescriptor.func1(0x0, 0x0)
	/usr/local/go/src/os/exec/exec.go:311 +0x70
os/exec.(*Cmd).Start.func1(0xc0000c4000, 0xc0000ae0c0)
	/usr/local/go/src/os/exec/exec.go:441 +0x3c
created by os/exec.(*Cmd).Start
	/usr/local/go/src/os/exec/exec.go:440 +0x454
@ALTree ALTree changed the title mips64:os/exec fatal error: all goroutines are asleep - deadlock! runtime: os/exec fatal error: all goroutines are asleep - deadlock! on mips64 Nov 25, 2020
@ianlancetaylor ianlancetaylor added the NeedsInvestigation label Nov 25, 2020
@ianlancetaylor ianlancetaylor added this to the Go1.16 milestone Nov 25, 2020
Copy link

@ianlancetaylor ianlancetaylor commented Nov 25, 2020

Does the program fail quickly, or does it wait for 10 seconds?

Is it possible for you to test this with Go tip? Thanks.

Please also include the output of running go env. The output you showed is from some other program. Thanks.

Copy link

@jgbooks jgbooks commented Nov 26, 2020

it fail quickly.
Before that, I compiled in AMD64, running on MIPS64

I try to build an go1.5.5 environment on MIPS64,The following problems occurred

root@topdesk-os:/home# go env
warning: GOPATH set to GOROOT (/usr/local/go) has no effect
fatal error: all goroutines are asleep - deadlock!

goroutine 1 [chan receive]:
os/exec.(*Cmd).Wait(0xc000140000, 0x0, 0x0)
	/opt/go-linux-mips64le-bootstrap/src/os/exec/exec.go:515 +0x128
os/exec.(*Cmd).Run(0xc000140000, 0xc0001062d0, 0xc000110580)
	/opt/go-linux-mips64le-bootstrap/src/os/exec/exec.go:341 +0x74
os/exec.(*Cmd).CombinedOutput(0xc000140000, 0xc00010e2c0, 0x2c, 0x2c, 0x2d, 0xc000110580)
	/opt/go-linux-mips64le-bootstrap/src/os/exec/exec.go:567 +0xbc
cmd/go/internal/work.(*Builder).gccSupportsFlag(0xc00011e3c0, 0xc00011c060, 0x1, 0x1, 0x6793cb, 0x16, 0x0)
	/opt/go-linux-mips64le-bootstrap/src/cmd/go/internal/work/exec.go:2466 +0x4e8
cmd/go/internal/work.(*Builder).compilerCmd(0xc00011e3c0, 0xc00011c060, 0x1, 0x1, 0x66d59d, 0x1, 0x0, 0x0, 0xc00010aa00, 0xc00010a9a0, ...)
	/opt/go-linux-mips64le-bootstrap/src/cmd/go/internal/work/exec.go:2375 +0x420
cmd/go/internal/work.(*Builder).GccCmd(0xc00011e3c0, 0x66d59d, 0x1, 0x0, 0x0, 0xc00010a9a0, 0x2, 0x2)
	/opt/go-linux-mips64le-bootstrap/src/cmd/go/internal/work/exec.go:2301 +0x6c
cmd/go/internal/envcmd.ExtraEnvVarsCostly(0x603200, 0xc000110360, 0x1)
	/opt/go-linux-mips64le-bootstrap/src/cmd/go/internal/envcmd/env.go:166 +0x1e0
cmd/go/internal/envcmd.runEnv(0x9f5640, 0xc00000a0d0, 0x0, 0x0)
	/opt/go-linux-mips64le-bootstrap/src/cmd/go/internal/envcmd/env.go:222 +0x1258
	/opt/go-linux-mips64le-bootstrap/src/cmd/go/main.go:190 +0x858

goroutine 17 [IO wait]:
internal/poll.runtime_pollWait(0xffc1da0e88, 0x72, 0x73cca0)
	/opt/go-linux-mips64le-bootstrap/src/runtime/netpoll.go:222 +0x60
internal/poll.(*pollDesc).wait(0xc00013c0d8, 0x72, 0x73cc01, 0x9b03e0, 0x0)
	/opt/go-linux-mips64le-bootstrap/src/internal/poll/fd_poll_runtime.go:87 +0x50
internal/poll.(*FD).Read(0xc00013c0c0, 0xc000022646, 0x5ba, 0x5ba, 0x0, 0x0, 0x0)
	/opt/go-linux-mips64le-bootstrap/src/internal/poll/fd_unix.go:159 +0x1c0
os.(*File).Read(0xc00010c028, 0xc000022646, 0x5ba, 0x5ba, 0x46, 0x0, 0x0)
	/opt/go-linux-mips64le-bootstrap/src/os/file.go:116 +0x7c
bytes.(*Buffer).ReadFrom(0xc0001062d0, 0x73bfc0, 0xc00010c028, 0xffc1dea998, 0xc0001062d0, 0x1)
	/opt/go-linux-mips64le-bootstrap/src/bytes/buffer.go:204 +0xcc
io.copyBuffer(0x73b320, 0xc0001062d0, 0x73bfc0, 0xc00010c028, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
	/opt/go-linux-mips64le-bootstrap/src/io/io.go:395 +0x338
os/exec.(*Cmd).writerDescriptor.func1(0x0, 0x0)
	/opt/go-linux-mips64le-bootstrap/src/os/exec/exec.go:311 +0x70
os/exec.(*Cmd).Start.func1(0xc000140000, 0xc00010ab60)
	/opt/go-linux-mips64le-bootstrap/src/os/exec/exec.go:441 +0x3c
created by os/exec.(*Cmd).Start
	/opt/go-linux-mips64le-bootstrap/src/os/exec/exec.go:440 +0x454

Copy link

@jgbooks jgbooks commented Dec 10, 2020

I found that this version works of "go version go1.13.15 linux/amd64".
When I have time, I'll find out why

Copy link

@jgbooks jgbooks commented Dec 10, 2020

I tired 1.14.2,and1.15.x, this is not work. only 1.13.15 works

Copy link

@odeke-em odeke-em commented Feb 7, 2021

Thanks for the report @jgbooks. I shall triage this for Go1.17, and mark it as needing investigation.

@odeke-em odeke-em removed this from the Go1.16 milestone Feb 7, 2021
@odeke-em odeke-em added this to the Go1.17 milestone Feb 7, 2021
Copy link

@dmitshur dmitshur commented May 21, 2021

We may not get to resolve this in Go 1.17, so moving to Backlog for now.

@dmitshur dmitshur removed this from the Go1.17 milestone May 21, 2021
@dmitshur dmitshur added this to the Backlog milestone May 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

No branches or pull requests

4 participants