diff options
| author | Jaylin <64823539+JaylinYu@users.noreply.github.com> | 2025-04-20 15:55:52 +0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2025-04-27 09:03:26 -0700 |
| commit | 8c8563c45afc3e6d6339ea3e7c087bd773f84052 (patch) | |
| tree | 9b0f02a26e8336fff55493a6574cefd736445907 /src/supplemental | |
| parent | 55925438bc8b8fd243ab995c48c8996ac49a6652 (diff) | |
| download | nng-8c8563c45afc3e6d6339ea3e7c087bd773f84052.tar.gz nng-8c8563c45afc3e6d6339ea3e7c087bd773f84052.tar.bz2 nng-8c8563c45afc3e6d6339ea3e7c087bd773f84052.zip | |
* 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.
Diffstat (limited to 'src/supplemental')
| -rw-r--r-- | src/supplemental/http/http_client.c | 4 |
1 files changed, 1 insertions, 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); } |
