mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 14:35:26 +00:00
[master] fix tcp client memory leak
4459. [bug] TCP client objects created to handle pipeline queries were not cleaned up correctly, causing uncontrolled memory growth. [RT #43106]
This commit is contained in:
4
CHANGES
4
CHANGES
@@ -1,5 +1,9 @@
|
||||
--- 9.11.0rc1 released ---
|
||||
|
||||
4459. [bug] TCP client objects created to handle pipeline queries
|
||||
were not cleaned up correctly, causing uncontrolled
|
||||
memory growth. [RT #43106]
|
||||
|
||||
4458. [cleanup] Update assertions to be more correct, and also remove
|
||||
use of a reserved word. [RT #43090]
|
||||
|
||||
|
@@ -4690,27 +4690,33 @@ chase_scanname(dns_name_t *name, dns_rdatatype_t type, dns_rdatatype_t covers)
|
||||
msg = ISC_LIST_NEXT(msg, link)) {
|
||||
if (dns_message_firstname(msg->msg, DNS_SECTION_ANSWER)
|
||||
== ISC_R_SUCCESS)
|
||||
{
|
||||
rdataset = chase_scanname_section(msg->msg, name,
|
||||
type, covers,
|
||||
DNS_SECTION_ANSWER);
|
||||
if (rdataset != NULL)
|
||||
return (rdataset);
|
||||
}
|
||||
if (dns_message_firstname(msg->msg, DNS_SECTION_AUTHORITY)
|
||||
== ISC_R_SUCCESS)
|
||||
{
|
||||
rdataset =
|
||||
chase_scanname_section(msg->msg, name,
|
||||
type, covers,
|
||||
DNS_SECTION_AUTHORITY);
|
||||
if (rdataset != NULL)
|
||||
return (rdataset);
|
||||
}
|
||||
if (dns_message_firstname(msg->msg, DNS_SECTION_ADDITIONAL)
|
||||
== ISC_R_SUCCESS)
|
||||
{
|
||||
rdataset =
|
||||
chase_scanname_section(msg->msg, name, type,
|
||||
covers,
|
||||
DNS_SECTION_ADDITIONAL);
|
||||
if (rdataset != NULL)
|
||||
return (rdataset);
|
||||
}
|
||||
}
|
||||
|
||||
return (NULL);
|
||||
|
@@ -3543,6 +3543,7 @@ get_worker(ns_clientmgr_t *manager, ns_interface_t *ifp, isc_socket_t *sock)
|
||||
|
||||
client->attributes |= NS_CLIENTATTR_TCP;
|
||||
client->pipelined = ISC_TRUE;
|
||||
client->mortal = ISC_TRUE;
|
||||
|
||||
isc_socket_attach(ifp->tcpsocket, &client->tcplistener);
|
||||
isc_socket_attach(sock, &client->tcpsocket);
|
||||
@@ -3672,7 +3673,6 @@ ns_client_logv(ns_client_t *client, isc_logcategory_t *category,
|
||||
isc_logmodule_t *module, int level, const char *fmt, va_list ap)
|
||||
{
|
||||
char msgbuf[4096];
|
||||
char peerbuf[ISC_SOCKADDR_FORMATSIZE];
|
||||
char signerbuf[DNS_NAME_FORMATSIZE], qnamebuf[DNS_NAME_FORMATSIZE];
|
||||
const char *viewname = "";
|
||||
const char *sep1 = "", *sep2 = "", *sep3 = "", *sep4 = "";
|
||||
@@ -3681,8 +3681,6 @@ ns_client_logv(ns_client_t *client, isc_logcategory_t *category,
|
||||
|
||||
vsnprintf(msgbuf, sizeof(msgbuf), fmt, ap);
|
||||
|
||||
ns_client_name(client, peerbuf, sizeof(peerbuf));
|
||||
|
||||
if (client->signer != NULL) {
|
||||
dns_name_format(client->signer, signerbuf, sizeof(signerbuf));
|
||||
sep1 = "/key ";
|
||||
@@ -3704,10 +3702,21 @@ ns_client_logv(ns_client_t *client, isc_logcategory_t *category,
|
||||
viewname = client->view->name;
|
||||
}
|
||||
|
||||
isc_log_write(ns_g_lctx, category, module, level,
|
||||
"client %s%s%s%s%s%s%s%s: %s",
|
||||
peerbuf, sep1, signer, sep2, qname, sep3,
|
||||
sep4, viewname, msgbuf);
|
||||
if (client->peeraddr_valid) {
|
||||
char peerbuf[ISC_SOCKADDR_FORMATSIZE];
|
||||
|
||||
isc_sockaddr_format(&client->peeraddr,
|
||||
peerbuf, sizeof(peerbuf));
|
||||
isc_log_write(ns_g_lctx, category, module, level,
|
||||
"client @%p %s%s%s%s%s%s%s%s: %s",
|
||||
client, peerbuf, sep1, signer, sep2, qname, sep3,
|
||||
sep4, viewname, msgbuf);
|
||||
} else {
|
||||
isc_log_write(ns_g_lctx, category, module, level,
|
||||
"client @%p%s%s%s%s%s%s%s: %s",
|
||||
client, sep1, signer, sep2, qname, sep3,
|
||||
sep4, viewname, msgbuf);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@@ -60,10 +60,12 @@ init_geoip_db(GeoIP **dbp, GeoIPDBTypes edition, GeoIPDBTypes fallback,
|
||||
}
|
||||
|
||||
info = GeoIP_database_info(db);
|
||||
if (info != NULL)
|
||||
if (info != NULL) {
|
||||
isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,
|
||||
NS_LOGMODULE_SERVER, ISC_LOG_INFO,
|
||||
"%s", info);
|
||||
free(info);
|
||||
}
|
||||
|
||||
*dbp = db;
|
||||
return;
|
||||
|
@@ -82,7 +82,7 @@ grep ";" dig.out.ns2
|
||||
$PERL ../digcomp.pl --lc dig.out.ns2 knowngood.dig.out || status=1
|
||||
|
||||
echo "I:only one tcp socket was used"
|
||||
tcpclients=`grep "client 10.53.0.7#[0-9]*:" ns2/named.run | awk '{print $4}' | sort | uniq -c | wc -l`
|
||||
tcpclients=`awk '$3 == "client" && $5 ~ /10.53.0.7#[0-9]*:/ {print $5}' ns2/named.run | sort | uniq -c | wc -l`
|
||||
|
||||
test $tcpclients -eq 1 || { status=1; echo "I:failed"; }
|
||||
|
||||
|
Reference in New Issue
Block a user