From 3a307d4f3e65294a7a942a81fc5bc259a0195605 Mon Sep 17 00:00:00 2001 From: Alina Sklarevich Date: Thu, 6 May 2021 13:10:30 +0300 Subject: [PATCH] UCP: handle a case of a null cm on the worker and update the NEWS file. may happen if the list of components that support CM is longer than the available cms on the host (worker->cms). --- NEWS | 1 + src/ucp/core/ucp_listener.c | 4 ++++ src/ucp/wireup/wireup_cm.c | 3 ++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 88266c82ad9..e4ea6a75cb5 100644 --- a/NEWS +++ b/NEWS @@ -18,6 +18,7 @@ * Fixes in ABI backward compatibility for active message protocol * Add support for DC full-handshake mode (off by default). * Fixes in Active Messages short reply protocol. +* Fixes for segmentation fault while listening for connections. ## 1.10.0 (March 9, 2021) ### Features: diff --git a/src/ucp/core/ucp_listener.c b/src/ucp/core/ucp_listener.c index 86871e148b6..12aa41e7f39 100644 --- a/src/ucp/core/ucp_listener.c +++ b/src/ucp/core/ucp_listener.c @@ -265,6 +265,10 @@ ucp_listen_on_cm(ucp_listener_h listener, const ucp_listener_params_t *params) for (i = 0; i < num_cms; ++i) { ucp_cm = &worker->cms[i]; + if (ucp_cm->cm == NULL) { + continue; + } + status = uct_listener_create(ucp_cm->cm, addr, params->sockaddr.addrlen, &uct_params, &uct_listeners[listener->num_rscs]); diff --git a/src/ucp/wireup/wireup_cm.c b/src/ucp/wireup/wireup_cm.c index a8140e03e1e..98629949b63 100644 --- a/src/ucp/wireup/wireup_cm.c +++ b/src/ucp/wireup/wireup_cm.c @@ -83,7 +83,8 @@ static int ucp_cm_client_try_fallback_cms(ucp_ep_h ep) ucp_rsc_index_t next_cm_idx = cm_wireup_ep->cm_idx + 1; uct_worker_cb_id_t prog_id = UCS_CALLBACKQ_ID_NULL; - if (next_cm_idx >= ucp_worker_num_cm_cmpts(worker)) { + if ((next_cm_idx >= ucp_worker_num_cm_cmpts(worker)) || + (worker->cms[next_cm_idx].cm == NULL)) { ucs_debug("reached the end of the cms priority list, no cms left to" " check (sockaddr_cm=%s, cm_idx=%d).", ucp_context_cm_name(worker->context, cm_wireup_ep->cm_idx),