[ARVADOS] created: 1.1.0-187-g89eceaf

Git user git at public.curoverse.com
Mon Nov 27 14:37:36 EST 2017


        at  89eceaf065b3dd21f5349cd9f1bb7d533a1c0059 (commit)


commit 89eceaf065b3dd21f5349cd9f1bb7d533a1c0059
Author: Tom Clegg <tclegg at veritasgenetics.com>
Date:   Mon Nov 27 14:34:14 2017 -0500

    12594: Fix missing log detail when process exits on signal.
    
    Example: sh -c "kill -9 $$"
    - Completed with exit code -1
    + Completed: signal: killed
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tclegg at veritasgenetics.com>

diff --git a/sdk/go/crunchrunner/crunchrunner.go b/sdk/go/crunchrunner/crunchrunner.go
index ca16fc6..e62f337 100644
--- a/sdk/go/crunchrunner/crunchrunner.go
+++ b/sdk/go/crunchrunner/crunchrunner.go
@@ -348,13 +348,13 @@ func runner(api IArvadosClient,
 		}
 	}
 
-	var success bool
-
-	exitCode := cmd.ProcessState.Sys().(syscall.WaitStatus).ExitStatus()
-
-	log.Printf("Completed with exit code %v", exitCode)
+	log.Printf("Completed: %s", cmd.ProcessState)
 
-	if inCodes(exitCode, taskp.PermanentFailCodes) {
+	var success bool
+	if !cmd.ProcessState.Exited() {
+		// e.g., killed by signal
+		success = false
+	} else if exitCode := cmd.ProcessState.Sys().(syscall.WaitStatus).ExitStatus(); inCodes(exitCode, taskp.PermanentFailCodes) {
 		success = false
 	} else if inCodes(exitCode, taskp.TemporaryFailCodes) {
 		return TempFail{fmt.Errorf("Process tempfail with exit code %v", exitCode)}
diff --git a/sdk/go/crunchrunner/crunchrunner_test.go b/sdk/go/crunchrunner/crunchrunner_test.go
index f2827c6..1cbd9ea 100644
--- a/sdk/go/crunchrunner/crunchrunner_test.go
+++ b/sdk/go/crunchrunner/crunchrunner_test.go
@@ -429,6 +429,23 @@ func (s *TestSuite) TestSignal(c *C) {
 
 }
 
+func (s *TestSuite) TestChildSignal(c *C) {
+	tmpdir, _ := ioutil.TempDir("", "")
+	defer os.RemoveAll(tmpdir)
+
+	err := runner(ArvTestClient{c,
+		"", false},
+		KeepTestClient{},
+		"zzzz-8i9sb-111111111111111",
+		"zzzz-ot0gb-111111111111111",
+		tmpdir,
+		"",
+		Job{ScriptParameters: Tasks{[]TaskDef{{
+			Command: []string{"sh", "-c", "kill -9 $$"}}}}},
+		Task{Sequence: 0})
+	c.Check(err, FitsTypeOf, PermFail{})
+}
+
 func (s *TestSuite) TestQuoting(c *C) {
 	tmpdir, _ := ioutil.TempDir("", "")
 	defer func() {

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list