Project

General

Profile

Actions

Bug #12594

closed

[crunch1] crunchrunner should report "signal: SIGKILL" instead of "exit code -1" if command exits via signal

Added by Tom Clegg over 6 years ago. Updated about 4 years ago.

Status:
Closed
Priority:
Normal
Assigned To:
-
Category:
-
Target version:
-
Story points:
-

Description

Currently, if a crunchrunner-based crunch1 job exits via signal, it doesn't log the signal. We just get this:

2017/11/09 17:42:03 Completed with exit code -1

Presumably this is because crunchrunner does this:

    exitCode := cmd.ProcessState.Sys().(syscall.WaitStatus).ExitStatus()

    log.Printf("Completed with exit code %v", exitCode)

even though ExitStatus returns useful results only if Exited(), not in the general case:

func (w WaitStatus) ExitStatus() int {
      if !w.Exited() {
          return -1
      }
      return int(w>>shift) & 0xFF
}

We could improve this by using ProcessState's String() method:

    log.Printf("Completed: %s", cmd.ProcessState)

This would give us "Completed: exit status 4" or "Completed: signal: SIGKILL"

We also check numeric values of exitCode; for that purpose, we can still use Sys().ExitStatus() -- but only when Exited() is true.

Actions #1

Updated by Tom Clegg over 6 years ago

12594-crunchrunner-log-signal @ 89eceaf065b3dd21f5349cd9f1bb7d533a1c0059

Logs now look like this:

2017/11/27 14:33:37 Completed: exit status 0

2017/11/27 14:33:37 Completed: signal: killed
Actions #2

Updated by Tom Clegg over 6 years ago

  • Status changed from New to In Progress
Actions #3

Updated by Peter Amstutz about 4 years ago

  • Status changed from In Progress to Closed
Actions

Also available in: Atom PDF