From dc9f55da5b8cfab72212454a737c6a416af79150 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ayd=C4=B1n=20Mercan?= Date: Fri, 24 May 2024 14:56:03 +0300 Subject: [PATCH 1/3] increase TCP4Clients/TCP6Clients after point of no failure Failing to accept TCP/TLS connections in 9.18 detaches the quota in isc__nm_failed_accept_cb, causing TCP4Clients and TCP6Clients statistics to not decrease inside cleanup. Fix by increasing the counter after the point of no failure but before handling statistics through the client's socket is no longer valid. --- lib/isc/netmgr/tcpdns.c | 4 ++-- lib/isc/netmgr/tlsdns.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/isc/netmgr/tcpdns.c b/lib/isc/netmgr/tcpdns.c index 1864a45aba..dd3e9ec3fe 100644 --- a/lib/isc/netmgr/tcpdns.c +++ b/lib/isc/netmgr/tcpdns.c @@ -1005,8 +1005,6 @@ accept_connection(isc_nmsocket_t *ssock, isc_quota_t *quota) { UV_RUNTIME_CHECK(uv_timer_init, r); uv_handle_set_data((uv_handle_t *)&csock->read_timer, csock); - isc__nm_incstats(csock, STATID_CLIENTS); - r = uv_accept(&ssock->uv_handle.stream, &csock->uv_handle.stream); if (r != 0) { result = isc__nm_uverr2result(r); @@ -1084,6 +1082,8 @@ accept_connection(isc_nmsocket_t *ssock, isc_quota_t *quota) { isc_nmhandle_detach(&handle); + isc__nm_incstats(csock, STATID_CLIENTS); + /* * sock is now attached to the handle. */ diff --git a/lib/isc/netmgr/tlsdns.c b/lib/isc/netmgr/tlsdns.c index 7a005db9b9..fa416e2fef 100644 --- a/lib/isc/netmgr/tlsdns.c +++ b/lib/isc/netmgr/tlsdns.c @@ -1629,8 +1629,6 @@ accept_connection(isc_nmsocket_t *ssock, isc_quota_t *quota) { UV_RUNTIME_CHECK(uv_timer_init, r); uv_handle_set_data((uv_handle_t *)&csock->read_timer, csock); - isc__nm_incstats(csock, STATID_CLIENTS); - r = uv_accept(&ssock->uv_handle.stream, &csock->uv_handle.stream); if (r != 0) { result = isc__nm_uverr2result(r); @@ -1727,6 +1725,8 @@ accept_connection(isc_nmsocket_t *ssock, isc_quota_t *quota) { goto failure; } + isc__nm_incstats(csock, STATID_CLIENTS); + /* * sock is now attached to the handle. */ From 1dc58c31beb4cad6c25ee7001e7f8aa07675994b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ayd=C4=B1n=20Mercan?= Date: Fri, 24 May 2024 15:18:15 +0300 Subject: [PATCH 2/3] add CHANGES and release note for GL #4425 --- CHANGES | 3 +++ doc/notes/notes-current.rst | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/CHANGES b/CHANGES index 71704f18b0..4d81ce8f18 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +6391. [bug] TCP client statistics could sometimes fail to decrease + when accepting client connection fails. [GL #4742] + 6390. [bug] Fix a data race in isc_task_purgeevent(). [GL !8937] 6389. [bug] dnssec-verify and dnssec-signzone could fail if there diff --git a/doc/notes/notes-current.rst b/doc/notes/notes-current.rst index 52d0cec18a..f0101b9833 100644 --- a/doc/notes/notes-current.rst +++ b/doc/notes/notes-current.rst @@ -43,6 +43,10 @@ Bug Fixes :iscman:`named` could crash with an assertion failure. This has been fixed. :gl:`#4719` +- The statistics channel counters that indicated the number of currently + connected TCP IPv4/IPv6 clients were not properly adjusted in certain + failure scenarios. This has been fixed. :gl:`#4742` + Known Issues ~~~~~~~~~~~~ From cb7924009152a4b8b1ec82a50bdb112541e9ec74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20K=C4=99pie=C5=84?= Date: Mon, 27 May 2024 15:03:18 +0200 Subject: [PATCH 3/3] Document TCP4Clients/TCP6Clients Commit abc47f5ce4a50ab2d3b23505914e9c65f856262b added two new statistics counters without documenting them. Add the missing counter descriptions to the ARM. --- doc/arm/reference.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/arm/reference.rst b/doc/arm/reference.rst index 48dbce13b7..88faad4023 100644 --- a/doc/arm/reference.rst +++ b/doc/arm/reference.rst @@ -8244,3 +8244,6 @@ exceptions are noted in the descriptions. ``RecvErr`` This indicates the number of errors in socket receive operations, including errors of send operations on a connected UDP socket, notified by an ICMP error message. + +``TCP4Clients``/``TCP6Clients`` + This indicates the number of IPv4/IPv6 clients currently connected over TCP.