Skip to content

Commit

Permalink
Avoid segfault in event notification
Browse files Browse the repository at this point in the history
Delay the checkout/release of the cached event object to ensure the
object remains valid until we are done with it.

Signed-off-by: Ralph Castain <rhc@pmix.org>
  • Loading branch information
rhc54 committed Mar 6, 2019
1 parent 379349a commit 17bb87f
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions src/event/pmix_event_notification.c
Original file line number Diff line number Diff line change
Expand Up @@ -1020,16 +1020,6 @@ static void _notify_client_event(int sd, short args, void *cbdata)
if (!pmix_notify_check_range(&rngtrk, &proc)) {
continue;
}
if (NULL != cd->targets) {
/* track the number of targets we have left to notify */
--cd->nleft;
/* if the event was cached and this is the last one,
* then evict this event from the cache */
if (0 == cd->nleft) {
pmix_hotel_checkout(&pmix_globals.notifications, cd->room);
PMIX_RELEASE(cd);
}
}
pmix_output_verbose(2, pmix_server_globals.event_output,
"pmix_server: notifying client %s:%u on status %s",
pr->peer->info->pname.nspace, pr->peer->info->pname.rank,
Expand Down Expand Up @@ -1087,6 +1077,17 @@ static void _notify_client_event(int sd, short args, void *cbdata)
if (PMIX_SUCCESS != rc) {
PMIX_RELEASE(bfr);
}
if (NULL != cd->targets && 0 < cd->nleft) {
/* track the number of targets we have left to notify */
--cd->nleft;
/* if the event was cached and this is the last one,
* then evict this event from the cache */
if (0 == cd->nleft) {
pmix_hotel_checkout(&pmix_globals.notifications, cd->room);
holdcd = false;
break;
}
}
}
}
}
Expand Down

0 comments on commit 17bb87f

Please sign in to comment.