Skip to content

Commit b9bd727

Browse files
author
Ralph Castain
committed
Ensure all event registrations are removed when a peer dies.
Backport of 6f65d0a Signed-off-by: Ralph Castain <[email protected]>
1 parent f7c2b2c commit b9bd727

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

opal/mca/pmix/pmix112/pmix/src/usock/usock_sendrecv.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ static void lost_connection(pmix_peer_t *peer, pmix_status_t err)
5353
pmix_server_trkr_t *trk;
5454
pmix_rank_info_t *rinfo, *rnext;
5555
pmix_trkr_caddy_t *tcd;
56+
pmix_regevents_info_t *reginfoptr, *regnext;
5657

5758
/* stop all events */
5859
if (peer->recv_ev_active) {
@@ -107,7 +108,15 @@ static void lost_connection(pmix_peer_t *peer, pmix_status_t err)
107108
/* do some cleanup as the client has left us */
108109
pmix_pointer_array_set_item(&pmix_server_globals.clients,
109110
peer->index, NULL);
110-
PMIX_RELEASE(peer);
111+
/* remove all registered event handlers so libevent doesn't complain */
112+
PMIX_LIST_FOREACH_SAFE(reginfoptr, regnext, &pmix_server_globals.client_eventregs, pmix_regevents_info_t) {
113+
if (reginfoptr->peer == peer) {
114+
pmix_list_remove_item(&pmix_server_globals.client_eventregs, &reginfoptr->super);
115+
PMIX_RELEASE(reginfoptr);
116+
break;
117+
}
118+
}
119+
PMIX_RELEASE(peer);
111120
} else {
112121
/* if I am a client, there is only
113122
* one connection we can have */

0 commit comments

Comments
 (0)