From fa24bad0f7f82b4718cc2f13f60fcdd9b0cf86fe Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Wed, 19 Jul 2017 17:20:51 -0700 Subject: Crash on close again. This one is caused by us deallocating the msg queue before we stop all asynchronous I/O operations; consequently we can wind up with a thread trying to access a msg queue after it has been destroyed. A lesson here is that nni_aio_fini() needs to be treated much like nni_thr_fini() - you should do this *before* deallocating anything that callback functions might be referencing. --- src/protocol/bus/bus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/protocol/bus') diff --git a/src/protocol/bus/bus.c b/src/protocol/bus/bus.c index 167c342d..17ef03bb 100644 --- a/src/protocol/bus/bus.c +++ b/src/protocol/bus/bus.c @@ -108,12 +108,12 @@ nni_bus_pipe_fini(void *arg) nni_bus_pipe *ppipe = arg; if (ppipe != NULL) { - nni_msgq_fini(ppipe->sendq); nni_mtx_fini(&ppipe->mtx); nni_aio_fini(&ppipe->aio_getq); nni_aio_fini(&ppipe->aio_send); nni_aio_fini(&ppipe->aio_recv); nni_aio_fini(&ppipe->aio_putq); + nni_msgq_fini(ppipe->sendq); NNI_FREE_STRUCT(ppipe); } } -- cgit v1.2.3-70-g09d2