Code
func RunXXXXCli(args []string, stdinInput string) ([]byte, string, error) {
mmutex.Lock()
cmd := exec.Command("path_to_xxxx_cli", args...)
cmd.Stdin = strings.NewReader(stdinInput)
res, err := cmd.CombinedOutput()
mmutex.Unlock()
return res, err
}
This cli shouldn't run in parallel and the test itself should run in parallel for faster result creation. For that I have locked the code at the beginning of the function and unlocked after the end of the function.
This does not happen always but happens rarely on a fast computer. (RAM: 64GB, Processor: 2.5GHz Intel Xeon).
Error Log
goroutine 132 [semacquire]:
sync.runtime_SemacquireMutex(0x572959c, 0x0, 0x1)
/usr/local/Cellar/go/1.13/libexec/src/runtime/sema.go:71 +0x47
sync.(*Mutex).lockSlow(0x5729598)
/usr/local/Cellar/go/1.13/libexec/src/sync/mutex.go:138 +0xfc
sync.(*Mutex).Lock(...)
/usr/local/Cellar/go/1.13/libexec/src/sync/mutex.go:81
This is very annoying issue, and I have been struggling for more than 2 weeks. This started to typically happen when the number of parallel running test cases increased. Is there anyone who has met similar issues before?
Aucun commentaire:
Enregistrer un commentaire