Ticket 9967 - Functions build_alloc_msg and slurm_free_resource_allocation_response_msg are inconsistent
Summary: Functions build_alloc_msg and slurm_free_resource_allocation_response_msg are...
Status: RESOLVED INVALID
Alias: None
Product: Slurm
Classification: Unclassified
Component: slurmctld (show other tickets)
Version: 20.02.3
Hardware: Linux Linux
: 6 - No support contract
Assignee: Jacob Jenson
QA Contact:
URL:
Depends on:
Blocks:
 
Reported: 2020-10-09 08:05 MDT by Anatoly M
Modified: 2020-10-09 08:06 MDT (History)
1 user (show)

See Also:
Site: -Other-
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:
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 Anatoly M 2020-10-09 08:05:49 MDT
Hi guys,

We found an interesting thing in your code. 
Functions build_alloc_msg and slurm_free_resource_allocation_response_msg are inconsistent.
Variable msg->environment created in build_alloc_msg is deleted incorrectly in 
slurm_free_resource_allocation_response_msg.
This led to the inoperability of the  job_ptr->details->env_sup structure filling mechanism
in the selection plugin.

Everything works fine if we apply this patch:

--- slurm-20.02.3.clean/src/slurmctld/proc_req.c      2020-05-21 23:34:01.000000000 +0300
+++ slurm-20.02.3/src/slurmctld/proc_req.c          2020-10-08 23:02:32.189548100 +0300
@@ -1295,11 +1295,12 @@
                if (job_ptr->details->env_cnt) {
                        alloc_msg->env_size = job_ptr->details->env_cnt;
                        alloc_msg->environment =
-                               xmalloc(sizeof(char *) * alloc_msg->env_size);
+                               xmalloc(sizeof(char *) * (alloc_msg->env_size + 1));
                        for (i = 0; i < alloc_msg->env_size; i++) {
                                alloc_msg->environment[i] =
                                        xstrdup(job_ptr->details->env_sup[i]);
                        }
+                       alloc_msg->environment[alloc_msg->env_size] = NULL;
                }
        } else {
                /* alloc_msg->pn_min_memory = 0; */