From 7ec0c70ca43f9d1020f3017282c749660aefbc05 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Sat, 5 Aug 2017 08:06:35 -0700 Subject: Don't shut down taskq too soon. With the new reapers, we've seen some problems caused by the reaper running after the taskq that they have to wait on (completion tasks for aios) are destroyed. We need to make sure that we tear down major subsystems in the correct order. --- src/core/endpt.c | 2 ++ src/core/init.c | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'src/core') diff --git a/src/core/endpt.c b/src/core/endpt.c index 68efaae5..0a5862f0 100644 --- a/src/core/endpt.c +++ b/src/core/endpt.c @@ -130,6 +130,7 @@ nni_ep_create(nni_ep **epp, nni_sock *sock, const char *addr, int mode) ep->ep_refcnt = 0; NNI_LIST_NODE_INIT(&ep->ep_node); + NNI_LIST_NODE_INIT(&ep->ep_reap_node); nni_pipe_ep_list_init(&ep->ep_pipes); @@ -253,6 +254,7 @@ nni_ep_stop(nni_ep *ep) nni_mtx_unlock(&ep->ep_mtx); nni_mtx_lock(&nni_ep_reap_lk); + NNI_ASSERT(!nni_list_node_active(&ep->ep_reap_node)); nni_list_append(&nni_ep_reap_list, ep); nni_cv_wake(&nni_ep_reap_cv); nni_mtx_unlock(&nni_ep_reap_lk); diff --git a/src/core/init.c b/src/core/init.c index 0c294506..7de2a497 100644 --- a/src/core/init.c +++ b/src/core/init.c @@ -69,13 +69,13 @@ nni_fini(void) { // XXX: We should make sure that underlying sockets and // file descriptors are closed. Details TBD. - nni_taskq_sys_fini(); nni_tran_sys_fini(); nni_pipe_sys_fini(); nni_ep_sys_fini(); nni_sock_sys_fini(); nni_random_sys_fini(); - nni_timer_sys_fini(); nni_aio_sys_fini(); + nni_timer_sys_fini(); + nni_taskq_sys_fini(); nni_plat_fini(); } -- cgit v1.2.3-70-g09d2