From 8c8563c45afc3e6d6339ea3e7c087bd773f84052 Mon Sep 17 00:00:00 2001 From: Jaylin <64823539+JaylinYu@users.noreply.github.com> Date: Sun, 20 Apr 2025 15:55:52 +0800 Subject: * FIX [HTTP] fix a blocking case when freeing http client basically when aio timeout before the connaio of dialer, and users try to free the http_client obj will end in infinite blocking at nni_http_client_fini. Possibly at nni_aio_free(c->aio); or nng_stream_dialer_free(c->dialer); Both racing case is due to the ingnored aio aborting here. Because the aio_begin is called before it is put into the nni_list. I assume you shall abort it no matter if it is in the dialing list. --- src/supplemental/http/http_client.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/supplemental/http/http_client.c b/src/supplemental/http/http_client.c index 1f5d8fbd..5c408718 100644 --- a/src/supplemental/http/http_client.c +++ b/src/supplemental/http/http_client.c @@ -179,13 +179,11 @@ http_dial_cancel(nni_aio *aio, void *arg, int rv) { nni_http_client *c = arg; nni_mtx_lock(&c->mtx); + nni_aio_abort(&c->aio, rv); if (nni_aio_list_active(aio)) { nni_aio_list_remove(aio); nni_aio_finish_error(aio, rv); } - if (nni_list_empty(&c->aios)) { - nni_aio_abort(&c->aio, rv); - } nni_mtx_unlock(&c->mtx); } -- cgit v1.2.3-70-g09d2