Ticket 12268 - epilog executed with SLURM_JOB_USER=root when shrinking a job
Summary: epilog executed with SLURM_JOB_USER=root when shrinking a job
Status: RESOLVED FIXED
Alias: None
Product: Slurm
Classification: Unclassified
Component: slurmd (show other tickets)
Version: 20.11.8
Hardware: Linux Linux
: 3 - Medium Impact
Assignee: Dominik Bartkiewicz
QA Contact:
URL:
Depends on:
Blocks:
 
Reported: 2021-08-12 17:32 MDT by Felix Abecassis
Modified: 2021-08-18 07:42 MDT (History)
5 users (show)

See Also:
Site: NVIDIA (PSLA)
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: 21.08.0
Target Release: ---
DevPrio: ---
Emory-Cloud Sites: ---


Attachments

Note You need to log in before you can comment on or make changes to this ticket.
Description Felix Abecassis 2021-08-12 17:32:00 MDT
Related to the investigation for a user job mentioned in https://bugs.schedmd.com/show_bug.cgi?id=12245 and https://bugs.schedmd.com/show_bug.cgi?id=12266

On a 8 slurmd single node cluster, we have the following in epilog.sh:
logger -s -t slurm-epilog "START user=$SLURM_JOB_USER job=$SLURM_JOB_ID node=$SLURMD_NODENAME"


Consider the following run.sub:
$ cat run_bug2.sub 
#!/bin/bash -eu
#SBATCH -N8

echo initial allocation: ${SLURM_NNODES} ${SLURM_NODELIST}

scontrol update jobid=${SLURM_JOBID} NumNodes=4 >/dev/null

source ./slurm_job_${SLURM_JOBID}_resize.sh
rm -f ./slurm_job_${SLURM_JOBID}_resize.{csh,sh}

echo new allocation: ${SLURM_NNODES} ${SLURM_NODELIST}

srun sleep 60s


Here is an example output:
$ cat slurm-439.out 
initial allocation: 8 node-[1-8]
new allocation: 4 node-[1-4]

But when shrinking the job to 4 nodes, the epilog is executed as if the job was owned by root:
SLURM_JOB_USER=root
SLURM_JOB_UID=0
SLURM_JOB_GID=0

The log is the following:
ug 12 16:24:37 ioctl slurm-epilog[249772]: START user=root job=439 node=node-6
Aug 12 16:24:37 ioctl slurm-epilog[249771]: START user=root job=439 node=node-5
Aug 12 16:24:37 ioctl slurm-epilog[249773]: START user=root job=439 node=node-7
Aug 12 16:24:37 ioctl slurm-epilog[249775]: START user=root job=439 node=node-8
Aug 12 16:25:38 ioctl slurm-epilog[249915]: START user=fabecassis job=439 node=node-4
Aug 12 16:25:38 ioctl slurm-epilog[249913]: START user=fabecassis job=439 node=node-2
Aug 12 16:25:38 ioctl slurm-epilog[249914]: START user=fabecassis job=439 node=node-1
Aug 12 16:25:38 ioctl slurm-epilog[249916]: START user=fabecassis job=439 node=node-3

This can cause a problem with our epilog scripts that attempt to detect known issues on the node after a job, on nodes that were removed early from the job, we can't attribute those issues to the right user.
Comment 3 Jason Booth 2021-08-17 15:18:17 MDT
We just wanted to update you and let you know that we have a patch for this issue currently going through our QA and review process. We will update you on the status once this is resolved.
Comment 5 Dominik Bartkiewicz 2021-08-18 07:42:41 MDT
Hi

Those commits fix this issue.
21.08.0 and above will include all of these fixes.

https://github.com/SchedMD/slurm/commit/d29e0f8b9d
https://github.com/SchedMD/slurm/commit/0a937b6a70

I'll go ahead and close this out.

Dominik