-
Notifications
You must be signed in to change notification settings - Fork 18.7k
Closed
Labels
Description
A fatal error is consistently being generated by the exec.Output() function on the arm platform. The function is being used to call a python script that returns a single line of text.
The function will intermittently fail after 5 to 200 calls with an "unlock of unlocked lock" error.
Using golang version 1.5.2.
The executable was cross-compiled on a Linux 32-bit VM for arm5. I have reduced the failure to the segment of code below.
Any suggestions would be much appreciated.
package main
import (
"fmt"
"os/exec"
"time"
)
func main() {
ticker := time.NewTicker(time.Millisecond * 200)
for {
select {
case <-ticker.C:
temp := GetBoardTemp()
fmt.Println("Temp: ", temp)
}
}
}
func GetBoardTemp() string {
cmd := exec.Command("boardtemp")
tempOut, _ := cmd.Output() // <-- intermittent fatal error on this line
return string(tempOut)
}
The error output:
fatal error: unlock of unlocked lock
runtime stack:
runtime.throw(0x1253d0, 0x17)
/home/lab/go/src/runtime/panic.go:527 +0x78
runtime.unlock(0x1a9358)
/home/lab/go/src/runtime/lock_futex.go:105 +0x54
runtime.atomicload64.func1()
/home/lab/go/src/runtime/atomic_arm.go:133 +0x100
runtime.systemstack(0x1032ff50)
/home/lab/go/src/runtime/asm_arm.s:256 +0xa8
goroutine 1 [runnable]:
syscall.Syscall(0x6, 0x9, 0x0, 0x0, 0x0, 0x0, 0x0)
/home/lab/go/src/syscall/asm_linux_arm.s:17 +0x8
syscall.Close(0x9, 0x0, 0x0)
/home/lab/go/src/syscall/zsyscall_linux_arm.go:296 +0x44
syscall.forkExec(0x10310790, 0xe, 0x1030a2d8, 0x1, 0x1, 0x10331d7c, 0x4f3f, 0x0, 0x0)
/home/lab/go/src/syscall/exec_unix.go:201 +0x3cc
syscall.StartProcess(0x10310790, 0xe, 0x1030a2d8, 0x1, 0x1, 0x10331d7c, 0x2, 0x4, 0x0, 0x0)
/home/lab/go/src/syscall/exec_unix.go:240 +0x64
os.startProcess(0x10310790, 0xe, 0x1030a2d8, 0x1, 0x1, 0x10331ea4, 0x1030cfc0, 0x0, 0x0)
/home/lab/go/src/os/exec_posix.go:45 +0x388
os.StartProcess(0x10310790, 0xe, 0x1030a2d8, 0x1, 0x1, 0x10331ea4, 0x0, 0x0, 0x0)
/home/lab/go/src/os/doc.go:24 +0x54
os/exec.(*Cmd).Start(0x1034e320, 0x0, 0x0)
/home/lab/go/src/os/exec/exec.go:328 +0x698
os/exec.(*Cmd).Run(0x1034e320, 0x0, 0x0)
/home/lab/go/src/os/exec/exec.go:255 +0x28
os/exec.(*Cmd).Output(0x1034e320, 0x0, 0x0, 0x0, 0x0, 0x0)
/home/lab/go/src/os/exec/exec.go:408 +0x188
main.GetBoardTemp(0x0, 0x0)
/home/lab/armLockTest/src/main/locktest.go:29 +0x4c
main.main()
/home/lab/armLockTest/src/main/locktest.go:18 +0x70