Skip to content

Commit

Permalink
Merge pull request #7058 from hzhou/2407_hydra_exit
Browse files Browse the repository at this point in the history
hydra/proxy: prevent double resetting exit_status

Approved-by: Ken Raffenetti
  • Loading branch information
hzhou authored Jul 9, 2024
2 parents 6c50f33 + 0e9457d commit fd36e53
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/pm/hydra/proxy/pmip_cb.c
Original file line number Diff line number Diff line change
Expand Up @@ -312,16 +312,19 @@ static HYD_status pmi_cb(int fd, HYD_event_t events, void *userp)
close(fd);

if (HYD_pmcd_pmip.user_global.auto_cleanup) {
/* kill all processes */
/* preset all exit_status except for the closed pid */
struct pmip_pg *pg = PMIP_pg_from_downstream(p);
for (int i = 0; i < pg->num_procs; i++) {
if (p != &pg->downstreams[i] &&
pg->downstreams[i].exit_status == PMIP_EXIT_STATUS_UNSET) {
pg->downstreams[i].exit_status = 0;
/* if exit_status has been set, the kill signals bcast'ed already */
if (p->exit_status == PMIP_EXIT_STATUS_UNSET) {
/* kill all processes */
/* preset all exit_status except for the closed pid */
struct pmip_pg *pg = PMIP_pg_from_downstream(p);
for (int i = 0; i < pg->num_procs; i++) {
if (p != &pg->downstreams[i] &&
pg->downstreams[i].exit_status == PMIP_EXIT_STATUS_UNSET) {
pg->downstreams[i].exit_status = 0;
}
}
PMIP_bcast_signal(SIGKILL);
}
PMIP_bcast_signal(SIGKILL);
} else {
/* If the user doesn't want to automatically cleanup,
* signal the remaining processes, and send this
Expand Down

0 comments on commit fd36e53

Please sign in to comment.