Ticket 694

Summary: jobs killed if exceed memory
Product: Slurm Reporter: Stuart Midgley <stuartm>
Component: SchedulingAssignee: David Bigagli <david>
Status: RESOLVED FIXED QA Contact:
Severity: 2 - High Impact    
Priority: --- CC: dauble
Version: 14.03.0   
Hardware: Linux   
OS: Linux   
Site: DownUnder GeoSolutions Slinky Site: ---
Alineos Sites: --- Atos/Eviden Sites: ---
Confidential Site: --- Coreweave sites: ---
Cray Sites: --- DS9 clusters: ---
Google sites: --- HPCnow Sites: ---
HPE Sites: --- IBM Sites: ---
NOAA SIte: --- NoveTech Sites: ---
Nvidia HWinf-CS Sites: --- OCF Sites: ---
Recursion Pharma Sites: --- SFW Sites: ---
SNIC sites: --- Tzag Elita Sites: ---
Linux Distro: --- Machine Name:
CLE Version: Version Fixed: 14.11.0pre1
Target Release: --- DevPrio: ---
Emory-Cloud Sites: ---
Attachments: attachment-23802-0.html
attachment-31611-0.html
attachment-15620-0.html
attachment-17020-0.html

Description Stuart Midgley 2014-04-13 04:00:39 MDT
Created attachment 746 [details]
attachment-23802-0.html

Evening

So, I went into production.  Jobs started being killed immediately when they went over their memory limit...  which our users are not use to setting.

First, when jobs are killed like this, they don't go into SE state... because the job has an exit code of 0???  and the epilogslurmctld only looks for non-zero???  This is a bit of a problem.

Second, how can I NOT kill jobs?  I thought I could set VSizeFactor but that won't help...
Comment 1 Stuart Midgley 2014-04-13 04:12:22 MDT
I have found the place in req.c that is killing the job... I think I'll comment it out, rebuild and redeploy.
Comment 2 David Bigagli 2014-04-13 10:18:36 MDT
I think it is ok to comment that code for a now. However what is the problem exactly?

On April 13, 2014 9:12:22 AM PDT, bugs@schedmd.com wrote:
>http://bugs.schedmd.com/show_bug.cgi?id=694
>
>--- Comment #1 from Stuart Midgley <stuartm@dugeo.com> ---
>I have found the place in req.c that is killing the job... I think I'll
>comment
>it out, rebuild and redeploy.
>
>-- 
>You are receiving this mail because:
>You are on the CC list for the bug.
>You are the assignee for the bug.
>You are watching someone on the CC list of the bug.
>You are watching the assignee of the bug.
Comment 3 Stuart Midgley 2014-04-13 13:35:22 MDT
The issue is that our users don't set their memory requests correctly or accurately.  They set it accurately enough for scheduling purposes but not for job control/monitoring.

I'd like to have the ability to allow the real memory to be over subscribed (like with virtual and time limits etc).

Nearly all jobs on our system use a whole node (--exclusive) so their memory request is sort of irrelavent (except for scheduling).  I'd basically like someway for their jobs to go over their memory request.

A parameter like VSizeFactor (Perhaps RSizeFactor ?)


The other issue is the exit status of the job.  I need to be able to detect all cases where the queue kills a job, catch it in the epilogslurmctld script, mark the job with SpecialExit and reschedule it in held state.

Thanks.
Comment 4 Moe Jette 2014-04-14 03:16:27 MDT
Slurm can easily be configured to completely ignore memory limits. For the SchedulingParameters change "CR_Core_Memory" or "CR_CPU_Memory" to just "CR_Core" or "CR_CPU". That might be the best solution unless or until your users are prepared to set memory limits.

Many sites also configure TaskPlugin=task/cgroup, which creates a container of the exact memory size requested by that job. The job will get malloc failures after reaching that limit. We could still possibly support an "overcommit" type of function that automatically increased each job's specified memory limit by some amount, but that does not exist today.
Comment 5 Stuart Midgley 2014-04-14 03:21:50 MDT
If we go down the CR_CPOU route, I assume that memory isn't used for scheduling purposes?  

We have a heterogeneous cluster and the memory request is a sort of "minimum" to run the job.  When the program starts up, it looks at the memory available and start an appropriate number of threads.
Comment 6 Stuart Midgley 2014-04-14 03:23:07 MDT
Extra... this is what I applied

diff --git a/src/common/slurm_jobacct_gather.c b/src/common/slurm_jobacct_gather.c
index 332ab7b80a..bd849d9df9 100644
--- a/src/common/slurm_jobacct_gather.c
+++ b/src/common/slurm_jobacct_gather.c
@@ -558,7 +558,7 @@ extern void jobacct_gather_handle_mem_limit(
                              total_job_mem, jobacct_mem_limit);
                }
        }
-       if (jobacct_job_id && jobacct_mem_limit &&
+/*     if (jobacct_job_id && jobacct_mem_limit &&
            (total_job_mem > jobacct_mem_limit)) {
                if (jobacct_step_id == NO_VAL) {
                        error("Job %u exceeded memory limit "
@@ -587,7 +587,7 @@ extern void jobacct_gather_handle_mem_limit(
                              jobacct_vmem_limit);
                }
                _acct_kill_step();
-       }
+       } */
 }
 
 /********************* jobacctinfo functions ******************************/
diff --git a/src/slurmd/slurmd/req.c b/src/slurmd/slurmd/req.c
index e43599222d..44eb559a34 100644
--- a/src/slurmd/slurmd/req.c
+++ b/src/slurmd/slurmd/req.c
@@ -2136,7 +2136,7 @@ _rpc_ping(slurm_msg_t *msg)
        }
 
        /* Take this opportunity to enforce any job memory limits */
-       _enforce_job_mem_limit();
+       /* _enforce_job_mem_limit(); */
        return rc;
 }
 
@@ -2171,7 +2171,7 @@ _rpc_health_check(slurm_msg_t *msg)
        }
 
        /* Take this opportunity to enforce any job memory limits */
-       _enforce_job_mem_limit();
+       /* _enforce_job_mem_limit(); */
        return rc;
 }




Even if we go with CR_CPU these routines still get executed don't they?  Or is the mem limit set to some massive value somewhere?
Comment 7 Moe Jette 2014-04-14 03:26:07 MDT
As I recall, when memory limits are not enforced the limits are set to zero (i.e. jobacct_mem_limit is zero below):

-       if (jobacct_job_id && jobacct_mem_limit &&
Comment 8 David Bigagli 2014-04-14 11:04:10 MDT
Hi,
   if your users specify --mem-per-cpu than Slurm will enforce it regardless of
CR_CORE or CR_CORE_Memory. We believe for now it is better for you to keep your
code changes that will prevent the termination of jobs.
We plan to develop a new slurm.conf parameter that will not kill jobs if they
use more memory than requested.

David
Comment 9 Stuart Midgley 2014-04-14 13:07:09 MDT
Thanks.

Any word on the epilogslurmctld issue?
Comment 10 David Bigagli 2014-04-14 13:29:10 MDT
Do you mean exit status after scancel or terminated job?

On April 14, 2014 6:07:09 PM PDT, bugs@schedmd.com wrote:
>http://bugs.schedmd.com/show_bug.cgi?id=694
>
>--- Comment #9 from Stuart Midgley <stuartm@dugeo.com> ---
>Thanks.
>
>Any word on the epilogslurmctld issue?
>
>-- 
>You are receiving this mail because:
>You are on the CC list for the bug.
>You are the assignee for the bug.
>You are watching someone on the CC list of the bug.
>You are watching the assignee of the bug.
Comment 11 David Bigagli 2014-04-14 13:29:19 MDT
Created attachment 760 [details]
attachment-31611-0.html
Comment 12 Stuart Midgley 2014-04-14 13:49:50 MDT
After a job is terminated by Slurm for some reason (exceeding some limit).  User induced I'm not so worried about.
Comment 13 David Bigagli 2014-04-14 14:02:35 MDT
The sure thing is that exit is not zero. This is something to think about.

On April 14, 2014 6:49:50 PM PDT, bugs@schedmd.com wrote:
>http://bugs.schedmd.com/show_bug.cgi?id=694
>
>--- Comment #12 from Stuart Midgley <stuartm@dugeo.com> ---
>After a job is terminated by Slurm for some reason (exceeding some
>limit). 
>User induced I'm not so worried about.
>
>-- 
>You are receiving this mail because:
>You are on the CC list for the bug.
>You are the assignee for the bug.
>You are watching someone on the CC list of the bug.
>You are watching the assignee of the bug.
Comment 14 David Bigagli 2014-04-14 14:02:44 MDT
Created attachment 761 [details]
attachment-15620-0.html
Comment 15 Stuart Midgley 2014-04-14 14:07:24 MDT
Hmmm...  unless you do something different with SLURM_JOB_EXIT_CODE2... Upon closer reading of the man page, should I also be looking at the signal sent?  Which I currently ignore.



#!/bin/bash

{

export PATH=/d/sw/slurm/latest/bin:/d/sw/slurm/latest/sbin:$PATH

JOB_EXIT=${SLURM_JOB_EXIT_CODE2%:*}

if (( JOB_EXIT > 0 )); then
    echo "$(date)    "$(for v in ${!SLURM_*}; do echo -n "${v}=${!v} "; done)

    for((i=1; ; i++)); do
        status=0
        scontrol requeuehold state=SpecialExit ${SLURM_JOB_ID} && break
        status=$?
        sleep $(( RANDOM % (30+i) ))
    done

    exit $status
fi

} >> /var/log/slurm/slurmctld_epilog.log 2>&1
Comment 16 Stuart Midgley 2014-04-14 14:30:34 MDT
This is a little fishy.  I've read the documenation for SLURM_JOB_EXIT_CODE and it idicates it should either be -1 or the PID of the process that finished (according to my reading of man 2 wait)...

now, I've looked in my epilog log and ALL the exit codes are the same (even on different machines)

    SLURM_JOB_EXIT_CODE=25600

Which doesn't seem right.
Comment 17 Stuart Midgley 2014-04-14 14:34:31 MDT
So, I assume I need to look at the <sig> in SLURM_JOB_EXIT_CODE2?  If so, what values are those?  In the case where Slurm kills jobs for going over memory?
Comment 18 David Bigagli 2014-04-14 16:43:28 MDT
We return what wait() does using the well known macros to get the meaningful bits. I think we should make sure there is no job kill by slurm so all return codes are your business :-)

On April 14, 2014 7:34:31 PM PDT, bugs@schedmd.com wrote:
>http://bugs.schedmd.com/show_bug.cgi?id=694
>
>--- Comment #17 from Stuart Midgley <stuartm@dugeo.com> ---
>So, I assume I need to look at the <sig> in SLURM_JOB_EXIT_CODE2?  If
>so, what
>values are those?  In the case where Slurm kills jobs for going over
>memory?
>
>-- 
>You are receiving this mail because:
>You are on the CC list for the bug.
>You are the assignee for the bug.
>You are watching someone on the CC list of the bug.
>You are watching the assignee of the bug.
Comment 19 David Bigagli 2014-04-14 16:43:40 MDT
Created attachment 763 [details]
attachment-17020-0.html
Comment 20 David Bigagli 2014-04-21 11:17:12 MDT
Fixed in commit 6b5646571cb2. 

David