Skip to content

Commit 6b14ecd

Browse files
committed
fixed a memory leak in sge_execd
// BelongsTo: CS-582
1 parent 950d62f commit 6b14ecd

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

source/daemons/execd/execd.cc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ int main(int argc, char **argv)
284284
cl_com_free_sirm_message(&status);
285285
}
286286

287-
/* finalize daeamonize */
287+
/* finalize daemonize */
288288
if (!getenv("SGE_ND")) {
289289
sge_daemonize_finalize();
290290
}
@@ -329,7 +329,7 @@ int main(int argc, char **argv)
329329
}
330330

331331
/*
332-
* We write pid file when we are connected to qmaster. Otherwise an old
332+
* We write pid file when we are connected to qmaster. Otherwise, an old
333333
* execd might overwrite our pidfile.
334334
*/
335335
sge_write_pid(EXECD_PID_FILE);
@@ -382,7 +382,6 @@ int main(int argc, char **argv)
382382
/* Start dispatching */
383383
execd_exit_state = sge_execd_process_messages();
384384

385-
386385
/*
387386
* This code is only reached when dispatcher terminates and execd goes down.
388387
*/

source/libs/sgeobj/sge_suser.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ int suser_check_new_job(const lListElem *job, u_long32 max_u_jobs, lList *master
255255
* int force_registration)
256256
*
257257
* FUNCTION
258-
* This function checks whether a new "job" would exceed the maxium
258+
* This function checks whether a new "job" would exceed the maximum
259259
* number of allowed jobs per user ("max_u_jobs"). JB_owner of "job"
260260
* is the username which will be used by this function to compare
261261
* the current number of registered jobs with "max_u_jobs". If the
@@ -287,10 +287,10 @@ int suser_register_new_job(const lListElem *job, u_long32 max_u_jobs,
287287

288288
DENTER(TOP_LAYER);
289289

290-
if (!force_registration){
290+
if (!force_registration) {
291291
ret = suser_check_new_job(job, max_u_jobs, master_suser_list);
292292
}
293-
if (ret == 0){
293+
if (ret == 0) {
294294
submit_user = lGetString(job, JB_owner);
295295
suser = suser_list_add(&master_suser_list, nullptr, submit_user);
296296
suser_increase_job_counter(suser);

source/libs/spool/classic/read_write_job.cc

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -743,8 +743,6 @@ int job_list_read_from_disk(lList **job_list, const char *list_name, int check,
743743
lListElem *first_direntry;
744744
DSTRING_STATIC(dstr_path, SGE_PATH_MAX);
745745
const char *str_path;
746-
int handle_as_zombie = (flags & SPOOL_HANDLE_AS_ZOMBIE) > 0;
747-
lList *master_suser_list = *ocs::DataStore::get_master_list_rw(SGE_TYPE_SUSER);
748746

749747
DENTER(TOP_LAYER);
750748
sge_get_file_path(first_dir, sizeof(first_dir), JOBS_SPOOL_DIR, FORMAT_FIRST_PART, flags, 0, 0, nullptr);
@@ -868,9 +866,12 @@ int job_list_read_from_disk(lList **job_list, const char *list_name, int check,
868866

869867
lSetList(job, JB_jid_successor_list, nullptr);
870868
job_list_add_job(job_list, list_name, job, 0);
871-
872-
if (!handle_as_zombie) {
869+
870+
bool handle_as_zombie = (flags & SPOOL_HANDLE_AS_ZOMBIE) > 0;
871+
bool in_execd = (flags & SPOOL_WITHIN_EXECD) > 0;
872+
if (!handle_as_zombie && !in_execd) {
873873
job_list_register_new_job(*ocs::DataStore::get_master_list(SGE_TYPE_JOB), mconf_get_max_jobs(), 1);
874+
lList *master_suser_list = *ocs::DataStore::get_master_list_rw(SGE_TYPE_SUSER);
874875
suser_register_new_job(job, mconf_get_max_u_jobs(), 1, master_suser_list);
875876
}
876877
}

0 commit comments

Comments
 (0)