From 9ee03613787c9b7d9c45dfc50a6e3c786f1c424d Mon Sep 17 00:00:00 2001
From: Brian Christiansen <brian@schedmd.com>
Date: Fri, 17 Mar 2017 08:50:28 -0600
Subject: [PATCH] Fix for reporting bad job state

I found today that SIGTERM'ed jobs show as OOM'ed in the database today.
From this commit:
commit 2a75b72df7681e24aa6e7b8825ab6387392b6002
A job terminating with SIG_TERM (and others) will incorrectly report
the job termination state as Out Of Memory.
---
 src/plugins/accounting_storage/mysql/as_mysql_job.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/plugins/accounting_storage/mysql/as_mysql_job.c b/src/plugins/accounting_storage/mysql/as_mysql_job.c
index cc761c98124..8f99e7907cf 100644
--- a/src/plugins/accounting_storage/mysql/as_mysql_job.c
+++ b/src/plugins/accounting_storage/mysql/as_mysql_job.c
@@ -1275,7 +1275,7 @@ extern int as_mysql_step_complete(mysql_conn_t *mysql_conn,
 	exit_code = step_ptr->exit_code;
 	comp_status = step_ptr->state & JOB_STATE_BASE;
 	if (comp_status < JOB_COMPLETE) {
-		if (exit_code & SIG_OOM) {
+		if (exit_code == SIG_OOM) {
 			comp_status = JOB_OOM;
 		} else if (WIFSIGNALED(exit_code)) {
 			comp_status = JOB_CANCELLED;
-- 
GitLab