Ian Lance Taylor would like Michael Munday to review this change.
runtime: ignore EAGAIN from exec in TestCgoExecSignalMask
Fixes #27731
Change-Id: Ifb4d57923b1bba0210ec1f623d779d7b5f442812
---
M src/runtime/testdata/testprogcgo/exec.go
1 file changed, 16 insertions(+), 0 deletions(-)
diff --git a/src/runtime/testdata/testprogcgo/exec.go b/src/runtime/testdata/testprogcgo/exec.go
index 2e94840..94da5dc 100644
--- a/src/runtime/testdata/testprogcgo/exec.go
+++ b/src/runtime/testdata/testprogcgo/exec.go
@@ -75,6 +75,14 @@
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
if err := cmd.Run(); err != nil {
+ // An overloaded system
+ // may fail with EAGAIN.
+ // This doesn't tell us
+ // anything useful; ignore it.
+ // Issue #27731.
+ if isEAGAIN(err) {
+ return
+ }
fmt.Printf("iteration %d: %v\n", j, err)
os.Exit(1)
}
@@ -87,3 +95,11 @@
fmt.Println("OK")
}
+
+// isEAGAIN reports whether err is an EAGAIN error from a process execution.
+func isEAGAIN(err error) bool {
+ if p, ok := err.(*os.PathError); ok {
+ err = p.Err
+ }
+ return err == syscall.EAGAIN
+}
To view, visit change 135995. To unsubscribe, or for help writing mail filters, visit settings.
TryBots beginning. Status page: https://farmer.golang.org/try?commit=d74c3db1
LGTM. I do wonder if we should put some resilience to EAGAIN into syscall.StartProcess though, given that there isn't an obvious way to detect temporary errors when using the os package.
Patch set 1:Code-Review +2
TryBots are happy.
Patch set 1:TryBot-Result +1
LGTM. I do wonder if we should put some resilience to EAGAIN into syscall.StartProcess though, given that there isn't an obvious way to detect temporary errors when using the os package.
I would be reluctant to change the syscall package. I think the syscall package should try to put as little as possible between the system and the program. We could consider doing it in the os package, but, since this problem presumably only occurs when the system is overloaded in some way, I would be concerned that retrying would just make the problem worse.
Ian Lance Taylor merged this change.
runtime: ignore EAGAIN from exec in TestCgoExecSignalMask
Fixes #27731
Change-Id: Ifb4d57923b1bba0210ec1f623d779d7b5f442812
Reviewed-on: https://go-review.googlesource.com/135995
Run-TryBot: Ian Lance Taylor <ia...@golang.org>
Reviewed-by: Michael Munday <mike....@ibm.com>
TryBot-Result: Gobot Gobot <go...@golang.org>