mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-30 22:15:20 +00:00
[master] give threads unique names to assist debugging
4602. [func] Threads are now set to human-readable names to assist debugging, when supported by the OS. [RT #43234]
This commit is contained in:
4
CHANGES
4
CHANGES
@@ -1,3 +1,7 @@
|
|||||||
|
4602. [func] Threads are now set to human-readable
|
||||||
|
names to assist debugging, when supported by
|
||||||
|
the OS. [RT #43234]
|
||||||
|
|
||||||
4601. [bug] Reject incorrect RSA key lengths during key
|
4601. [bug] Reject incorrect RSA key lengths during key
|
||||||
generation and and sign/verify context
|
generation and and sign/verify context
|
||||||
creation. [RT #45043]
|
creation. [RT #45043]
|
||||||
|
@@ -383,6 +383,15 @@ int sigwait(const unsigned int *set, int *sig);
|
|||||||
/* Support for PTHREAD_MUTEX_ADAPTIVE_NP */
|
/* Support for PTHREAD_MUTEX_ADAPTIVE_NP */
|
||||||
#undef HAVE_PTHREAD_MUTEX_ADAPTIVE_NP
|
#undef HAVE_PTHREAD_MUTEX_ADAPTIVE_NP
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <pthread_np.h> header file. */
|
||||||
|
#undef HAVE_PTHREAD_NP_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `pthread_setname_np' function. */
|
||||||
|
#undef HAVE_PTHREAD_SETNAME_NP
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `pthread_set_name_np' function. */
|
||||||
|
#undef HAVE_PTHREAD_SET_NAME_NP
|
||||||
|
|
||||||
/* Define to 1 if you have the `pthread_yield' function. */
|
/* Define to 1 if you have the `pthread_yield' function. */
|
||||||
#undef HAVE_PTHREAD_YIELD
|
#undef HAVE_PTHREAD_YIELD
|
||||||
|
|
||||||
|
26
configure
vendored
26
configure
vendored
@@ -15665,6 +15665,32 @@ fi
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
# Look for functions relating to thread naming
|
||||||
|
for ac_func in pthread_setname_np pthread_set_name_np
|
||||||
|
do :
|
||||||
|
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
||||||
|
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
|
||||||
|
if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
|
||||||
|
cat >>confdefs.h <<_ACEOF
|
||||||
|
#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
|
||||||
|
_ACEOF
|
||||||
|
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
for ac_header in pthread_np.h
|
||||||
|
do :
|
||||||
|
ac_fn_c_check_header_mongrel "$LINENO" "pthread_np.h" "ac_cv_header_pthread_np_h" "$ac_includes_default"
|
||||||
|
if test "x$ac_cv_header_pthread_np_h" = xyes; then :
|
||||||
|
cat >>confdefs.h <<_ACEOF
|
||||||
|
#define HAVE_PTHREAD_NP_H 1
|
||||||
|
_ACEOF
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Look for sysconf to allow detection of the number of processors.
|
# Look for sysconf to allow detection of the number of processors.
|
||||||
#
|
#
|
||||||
|
@@ -1351,6 +1351,10 @@ then
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
# Look for functions relating to thread naming
|
||||||
|
AC_CHECK_FUNCS(pthread_setname_np pthread_set_name_np)
|
||||||
|
AC_CHECK_HEADERS(pthread_np.h)
|
||||||
|
|
||||||
#
|
#
|
||||||
# Look for sysconf to allow detection of the number of processors.
|
# Look for sysconf to allow detection of the number of processors.
|
||||||
#
|
#
|
||||||
|
@@ -266,6 +266,16 @@
|
|||||||
|
|
||||||
<section xml:id="relnotes_changes"><info><title>Feature Changes</title></info>
|
<section xml:id="relnotes_changes"><info><title>Feature Changes</title></info>
|
||||||
<itemizedlist>
|
<itemizedlist>
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
Threads in <command>named</command> are now set to human-readable
|
||||||
|
names to assist debugging on operating systems that support that.
|
||||||
|
Threads will have names such as "isc-timer", "isc-sockmgr",
|
||||||
|
"isc-worker0001", and so on. This will affect the reporting of
|
||||||
|
subsidiary thread names in <command>ps</command> and
|
||||||
|
<command>top</command>, but not the main thread. [RT #43234]
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>
|
<para>
|
||||||
The Response Policy Zone (RPZ) implementation has been
|
The Response Policy Zone (RPZ) implementation has been
|
||||||
@@ -313,55 +323,7 @@
|
|||||||
<itemizedlist>
|
<itemizedlist>
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>
|
<para>
|
||||||
A synthesized CNAME record appearing in a response before the
|
None.
|
||||||
associated DNAME could be cached, when it should not have been.
|
|
||||||
This was a regression introduced while addressing CVE-2016-8864.
|
|
||||||
[RT #44318]
|
|
||||||
</para>
|
|
||||||
</listitem>
|
|
||||||
<listitem>
|
|
||||||
<para>
|
|
||||||
<command>named</command> could deadlock if multiple changes
|
|
||||||
to NSEC/NSEC3 parameters for the same zone were being processed
|
|
||||||
at the same time. [RT #42770]
|
|
||||||
</para>
|
|
||||||
</listitem>
|
|
||||||
<listitem>
|
|
||||||
<para>
|
|
||||||
<command>named</command> could trigger an assertion when
|
|
||||||
sending NOTIFY messages. [RT #44019]
|
|
||||||
</para>
|
|
||||||
</listitem>
|
|
||||||
<listitem>
|
|
||||||
<para>
|
|
||||||
Referencing a nonexistent zone in a <command>response-policy</command>
|
|
||||||
statement could cause an assertion failure during configuration.
|
|
||||||
[RT #43787]
|
|
||||||
</para>
|
|
||||||
</listitem>
|
|
||||||
<listitem>
|
|
||||||
<para>
|
|
||||||
<command>rndc addzone</command> could cause a crash
|
|
||||||
when attempting to add a zone with a type other than
|
|
||||||
<command>master</command> or <command>slave</command>.
|
|
||||||
Such zones are now rejected. [RT #43665]
|
|
||||||
</para>
|
|
||||||
</listitem>
|
|
||||||
<listitem>
|
|
||||||
<para>
|
|
||||||
<command>named</command> could hang when encountering log
|
|
||||||
file names with large apparent gaps in version number (for
|
|
||||||
example, when files exist called "logfile.0", "logfile.1",
|
|
||||||
and "logfile.1482954169"). This is now handled correctly.
|
|
||||||
[RT #38688]
|
|
||||||
</para>
|
|
||||||
</listitem>
|
|
||||||
<listitem>
|
|
||||||
<para>
|
|
||||||
If a zone was updated while <command>named</command> was
|
|
||||||
processing a query for nonexistent data, it could return
|
|
||||||
out-of-sync NSEC3 records causing potential DNSSEC validation
|
|
||||||
failure. [RT #43247]
|
|
||||||
</para>
|
</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</itemizedlist>
|
</itemizedlist>
|
||||||
|
@@ -19,6 +19,9 @@ ISC_LANG_BEGINDECLS
|
|||||||
void
|
void
|
||||||
isc_thread_setconcurrency(unsigned int level);
|
isc_thread_setconcurrency(unsigned int level);
|
||||||
|
|
||||||
|
void
|
||||||
|
isc_thread_setname(isc_thread_t, const char *);
|
||||||
|
|
||||||
#define isc_thread_self() ((unsigned long)0)
|
#define isc_thread_self() ((unsigned long)0)
|
||||||
#define isc_thread_yield() ((void)0)
|
#define isc_thread_yield() ((void)0)
|
||||||
|
|
||||||
|
@@ -17,3 +17,8 @@ void
|
|||||||
isc_thread_setconcurrency(unsigned int level) {
|
isc_thread_setconcurrency(unsigned int level) {
|
||||||
UNUSED(level);
|
UNUSED(level);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void isc_thread_setname(isc_thread_t thread, const char *name) {
|
||||||
|
UNUSED(thread);
|
||||||
|
UNUSED(name);
|
||||||
|
}
|
||||||
|
@@ -15,6 +15,10 @@
|
|||||||
|
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
|
||||||
|
#if defined(HAVE_PTHREAD_NP_H)
|
||||||
|
#include <pthread_np.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <isc/lang.h>
|
#include <isc/lang.h>
|
||||||
#include <isc/result.h>
|
#include <isc/result.h>
|
||||||
|
|
||||||
@@ -35,6 +39,9 @@ isc_thread_setconcurrency(unsigned int level);
|
|||||||
void
|
void
|
||||||
isc_thread_yield(void);
|
isc_thread_yield(void);
|
||||||
|
|
||||||
|
void
|
||||||
|
isc_thread_setname(isc_thread_t, const char *);
|
||||||
|
|
||||||
/* XXX We could do fancier error handling... */
|
/* XXX We could do fancier error handling... */
|
||||||
|
|
||||||
#define isc_thread_join(t, rp) \
|
#define isc_thread_join(t, rp) \
|
||||||
|
@@ -70,6 +70,22 @@ isc_thread_setconcurrency(unsigned int level) {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
isc_thread_setname(isc_thread_t thread, const char *name) {
|
||||||
|
#if defined(HAVE_PTHREAD_SETNAME_NP) && defined(_GNU_SOURCE)
|
||||||
|
/*
|
||||||
|
* macOS has pthread_setname_np but only works on the
|
||||||
|
* current thread so it's not used here
|
||||||
|
*/
|
||||||
|
(void)pthread_setname_np(thread, name);
|
||||||
|
#elif defined(HAVE_PTHREAD_SET_NAME_NP)
|
||||||
|
(void)pthread_set_name_np(thread, name);
|
||||||
|
#else
|
||||||
|
UNUSED(thread);
|
||||||
|
UNUSED(name);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
isc_thread_yield(void) {
|
isc_thread_yield(void) {
|
||||||
#if defined(HAVE_SCHED_YIELD)
|
#if defined(HAVE_SCHED_YIELD)
|
||||||
|
@@ -1449,6 +1449,10 @@ isc__taskmgr_create(isc_mem_t *mctx, unsigned int workers,
|
|||||||
if (isc_thread_create(run, manager,
|
if (isc_thread_create(run, manager,
|
||||||
&manager->threads[manager->workers]) ==
|
&manager->threads[manager->workers]) ==
|
||||||
ISC_R_SUCCESS) {
|
ISC_R_SUCCESS) {
|
||||||
|
char name[16]; /* thread name limit on Linux */
|
||||||
|
snprintf(name, sizeof(name), "isc-worker%04d", i);
|
||||||
|
isc_thread_setname(manager->threads[manager->workers],
|
||||||
|
name);
|
||||||
manager->workers++;
|
manager->workers++;
|
||||||
started++;
|
started++;
|
||||||
}
|
}
|
||||||
|
@@ -914,6 +914,7 @@ isc__timermgr_create(isc_mem_t *mctx, isc_timermgr_t **managerp) {
|
|||||||
ISC_MSG_FAILED, "failed"));
|
ISC_MSG_FAILED, "failed"));
|
||||||
return (ISC_R_UNEXPECTED);
|
return (ISC_R_UNEXPECTED);
|
||||||
}
|
}
|
||||||
|
isc_thread_setname(manager->thread, "isc-timer");
|
||||||
#endif
|
#endif
|
||||||
#ifdef USE_SHARED_MANAGER
|
#ifdef USE_SHARED_MANAGER
|
||||||
manager->refs = 1;
|
manager->refs = 1;
|
||||||
|
@@ -4772,6 +4772,7 @@ isc__socketmgr_create2(isc_mem_t *mctx, isc_socketmgr_t **managerp,
|
|||||||
result = ISC_R_UNEXPECTED;
|
result = ISC_R_UNEXPECTED;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
isc_thread_setname(manager->watcher, "isc-socket");
|
||||||
#endif /* USE_WATCHER_THREAD */
|
#endif /* USE_WATCHER_THREAD */
|
||||||
isc_mem_attach(mctx, &manager->mctx);
|
isc_mem_attach(mctx, &manager->mctx);
|
||||||
|
|
||||||
|
@@ -74,6 +74,9 @@ isc_thread_join(isc_thread_t, isc_threadresult_t *);
|
|||||||
void
|
void
|
||||||
isc_thread_setconcurrency(unsigned int level);
|
isc_thread_setconcurrency(unsigned int level);
|
||||||
|
|
||||||
|
void
|
||||||
|
isc_thread_setname(isc_thread_t, const char *);
|
||||||
|
|
||||||
int
|
int
|
||||||
isc_thread_key_create(isc_thread_key_t *key, void (*func)(void *));
|
isc_thread_key_create(isc_thread_key_t *key, void (*func)(void *));
|
||||||
|
|
||||||
|
@@ -705,6 +705,7 @@ isc_thread_key_delete
|
|||||||
isc_thread_key_getspecific
|
isc_thread_key_getspecific
|
||||||
isc_thread_key_setspecific
|
isc_thread_key_setspecific
|
||||||
isc_thread_setconcurrency
|
isc_thread_setconcurrency
|
||||||
|
isc_thread_setname
|
||||||
isc_time_add
|
isc_time_add
|
||||||
isc_time_compare
|
isc_time_compare
|
||||||
isc_time_formatISO8601
|
isc_time_formatISO8601
|
||||||
|
@@ -58,6 +58,12 @@ isc_thread_setconcurrency(unsigned int level) {
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
isc_thread_setname(isc_thread_t thread, const char *name) {
|
||||||
|
UNUSED(thread);
|
||||||
|
UNUSED(name);
|
||||||
|
}
|
||||||
|
|
||||||
void *
|
void *
|
||||||
isc_thread_key_getspecific(isc_thread_key_t key) {
|
isc_thread_key_getspecific(isc_thread_key_t key) {
|
||||||
return(TlsGetValue(key));
|
return(TlsGetValue(key));
|
||||||
|
Reference in New Issue
Block a user