diff --git a/cmake/os/Linux.cmake b/cmake/os/Linux.cmake index 6fde915165f..f629661a5c9 100644 --- a/cmake/os/Linux.cmake +++ b/cmake/os/Linux.cmake @@ -20,7 +20,6 @@ INCLUDE(CheckSymbolExists) # Something that needs to be set on legacy reasons SET(TARGET_OS_LINUX 1) -SET(HAVE_NPTL 1) SET(_GNU_SOURCE 1) SET(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} -D_GNU_SOURCE=1) diff --git a/config.h.cmake b/config.h.cmake index 3f8634519af..2a270749661 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -172,7 +172,6 @@ #cmakedefine HAVE_LSTAT 1 #cmakedefine HAVE_MEMALIGN 1 /* #cmakedefine HAVE_MLOCK 1 see Bug#54662 */ -#cmakedefine HAVE_NPTL 1 #cmakedefine HAVE_NL_LANGINFO 1 #cmakedefine HAVE_MADVISE 1 #cmakedefine HAVE_DECL_MADVISE 1 diff --git a/include/my_pthread.h b/include/my_pthread.h index 17813047ce5..41af69bb54d 100644 --- a/include/my_pthread.h +++ b/include/my_pthread.h @@ -739,18 +739,7 @@ extern uint my_thread_end_wait_time; extern my_bool safe_mutex_deadlock_detector; #define my_thread_var (_my_thread_var()) #define my_errno my_thread_var->thr_errno -/* - Keep track of shutdown,signal, and main threads so that my_end() will not - report errors with them -*/ -/* Which kind of thread library is in use */ - -#define THD_LIB_OTHER 1 -#define THD_LIB_NPTL 2 -#define THD_LIB_LT 4 - -extern uint thd_lib_detected; /* thread_safe_xxx functions are for critical statistic or counters. diff --git a/mysql-test/valgrind.supp b/mysql-test/valgrind.supp index d33cbcf2694..5f4ca8bc421 100644 --- a/mysql-test/valgrind.supp +++ b/mysql-test/valgrind.supp @@ -656,182 +656,6 @@ } -# -# Some problem inside glibc on Ubuntu 9.04, x86 (but not amd64): -# -# ==5985== 19 bytes in 1 blocks are still reachable in loss record 1 of 6 -# ==5985== at 0x7AF3FDE: malloc (vg_replace_malloc.c:207) -# ... 11,12, or 13 functions w/o symbols ... -# ==5985== by 0x8717185: nptl_pthread_exit_hack_handler (my_thr_init.c:55) -# -# Since valgrind 3.3.0 doesn't support '...' multi-function pattern, using -# multiple suppressions: -# -{ - Mem loss inside nptl_pthread_exit_hack_handler - Memcheck:Leak - fun:* - fun:* - fun:* - fun:* - fun:* - fun:* - fun:* - fun:* - fun:* - fun:* - fun:* - fun:* - fun:nptl_pthread_exit_hack_handler -} - -{ - Mem loss inside nptl_pthread_exit_hack_handler - Memcheck:Leak - fun:* - fun:* - fun:* - fun:* - fun:* - fun:* - fun:* - fun:* - fun:* - fun:* - fun:* - fun:* - fun:* - fun:nptl_pthread_exit_hack_handler -} - -{ - Mem loss inside nptl_pthread_exit_hack_handler - Memcheck:Leak - fun:* - fun:* - fun:* - fun:* - fun:* - fun:* - fun:* - fun:* - fun:* - fun:* - fun:* - fun:* - fun:* - fun:* - fun:nptl_pthread_exit_hack_handler -} - -# -# BUG#45630 -# Suppress valgrind failures within nptl_pthread_exit_hack_handler on Ubuntu 9.04, x86 (but not amd64) -# - -{ - Mem loss within nptl_pthread_exit_hack_handler 1 - Memcheck:Leak - fun:malloc - obj:*/ld-*.so - obj:*/ld-*.so - obj:*/ld-*.so - obj:*/ld-*.so - obj:*/ld-*.so - obj:*/libc-*.so - obj:*/ld-*.so - fun:__libc_dlopen_mode - fun:pthread_cancel_init - fun:_Unwind_ForcedUnwind - fun:__pthread_unwind - fun:pthread_exit - fun:nptl_pthread_exit_hack_handler - fun:start_thread - fun:clone -} - -{ - Mem loss within nptl_pthread_exit_hack_handler 2 - Memcheck:Leak - fun:malloc - obj:*/ld-*.so - obj:*/ld-*.so - obj:*/ld-*.so - obj:*/ld-*.so - obj:*/libc-*.so - obj:*/ld-*.so - fun:__libc_dlopen_mode - fun:pthread_cancel_init - fun:_Unwind_ForcedUnwind - fun:__pthread_unwind - fun:pthread_exit - fun:nptl_pthread_exit_hack_handler - fun:start_thread - fun:clone -} - -{ - Mem loss within nptl_pthread_exit_hack_handler 3 - Memcheck:Leak - fun:calloc - obj:*/ld-*.so - obj:*/ld-*.so - obj:*/ld-*.so - obj:*/ld-*.so - obj:*/libc-*.so - obj:*/ld-*.so - fun:__libc_dlopen_mode - fun:pthread_cancel_init - fun:_Unwind_ForcedUnwind - fun:__pthread_unwind - fun:pthread_exit - fun:nptl_pthread_exit_hack_handler - fun:start_thread - fun:clone -} - -{ - Mem loss within nptl_pthread_exit_hack_handler 4 - Memcheck:Leak - fun:malloc - obj:*/ld-*.so - obj:*/ld-*.so - obj:*/ld-*.so - obj:*/ld-*.so - obj:*/ld-*.so - obj:*/ld-*.so - obj:*/libc-*.so - obj:*/ld-*.so - fun:__libc_dlopen_mode - fun:pthread_cancel_init - fun:_Unwind_ForcedUnwind - fun:__pthread_unwind - fun:pthread_exit - fun:nptl_pthread_exit_hack_handler - fun:start_thread -} - -{ - Mem loss within nptl_pthread_exit_hack_handler 5 - Memcheck:Leak - fun:calloc - obj:*/ld-*.so - obj:*/ld-*.so - obj:*/ld-*.so - obj:*/ld-*.so - obj:*/ld-*.so - obj:*/ld-*.so - obj:*/libc-*.so - obj:*/ld-*.so - fun:__libc_dlopen_mode - fun:pthread_cancel_init - fun:_Unwind_ForcedUnwind - fun:__pthread_unwind - fun:pthread_exit - fun:nptl_pthread_exit_hack_handler - fun:start_thread -} - # # Problem with glibc and gethostbyaddr_r # @@ -846,113 +670,6 @@ fun: gethostbyaddr_r } -# suppressions for glibc 2.6.1 64 bit - -{ - Mem loss within nptl_pthread_exit_hack_handler 6 - Memcheck:Leak - fun:malloc - obj:*/ld-*.so - obj:*/ld-*.so - obj:*/ld-*.so - obj:*/ld-*.so - obj:*/ld-*.so - obj:*/ld-*.so - obj:*/libc-*.so - obj:*/ld-*.so - obj:*/libc-*.so - fun:__libc_dlopen_mode - fun:pthread_cancel_init - fun:_Unwind_ForcedUnwind - fun:__pthread_unwind - fun:pthread_exit - fun:nptl_pthread_exit_hack_handler -} - -{ - Mem loss within nptl_pthread_exit_hack_handler 7 - Memcheck:Leak - fun:malloc - obj:*/ld-*.so - obj:*/ld-*.so - obj:*/ld-*.so - obj:*/ld-*.so - obj:*/libc-*.so - obj:*/ld-*.so - obj:*/libc-*.so - fun:__libc_dlopen_mode - fun:pthread_cancel_init - fun:_Unwind_ForcedUnwind - fun:__pthread_unwind - fun:pthread_exit - fun:nptl_pthread_exit_hack_handler - fun:start_thread - fun:clone -} - -{ - Mem loss within nptl_pthread_exit_hack_handler 8 - Memcheck:Leak - fun:calloc - obj:*/ld-*.so - obj:*/ld-*.so - obj:*/ld-*.so - obj:*/ld-*.so - obj:*/libc-*.so - obj:*/ld-*.so - obj:*/libc-*.so - fun:__libc_dlopen_mode - fun:pthread_cancel_init - fun:_Unwind_ForcedUnwind - fun:__pthread_unwind - fun:pthread_exit - fun:nptl_pthread_exit_hack_handler - fun:start_thread - fun:clone -} - -{ - Mem loss within nptl_pthread_exit_hack_handler 8 - Memcheck:Leak - fun:calloc - obj:*/ld-*.so - obj:*/ld-*.so - obj:*/ld-*.so - obj:*/ld-*.so - obj:*/ld-*.so - obj:*/ld-*.so - obj:*/libc-*.so - obj:*/ld-*.so - obj:*/libc-*.so - fun:__libc_dlopen_mode - fun:pthread_cancel_init - fun:_Unwind_ForcedUnwind - fun:__pthread_unwind - fun:pthread_exit - fun:nptl_pthread_exit_hack_handler -} - -{ - Invalid read within nptl_pthread_exit_hack_handler - Memcheck:Addr8 - obj:*/ld-*.so - obj:*/ld-*.so - obj:*/ld-*.so - obj:*/ld-*.so - obj:*/ld-*.so - obj:*/ld-*.so - obj:*/ld-*.so - obj:*/libc-*.so - obj:*/ld-*.so - obj:*/libc-*.so - fun:__libc_dlopen_mode - fun:pthread_cancel_init - fun:_Unwind_ForcedUnwind - fun:__pthread_unwind - fun:pthread_exit - fun:nptl_pthread_exit_hack_handler -} - { memory "leak" in backtrace() of glibc 2.9 (not present in 2.13) Memcheck:Leak diff --git a/mysys/my_pthread.c b/mysys/my_pthread.c index ac6d3f87de3..c1567f2cd03 100644 --- a/mysys/my_pthread.c +++ b/mysys/my_pthread.c @@ -29,8 +29,6 @@ #define SCHED_POLICY SCHED_OTHER #endif -uint thd_lib_detected= 0; - /* Some functions for RTS threads, AIX, Siemens Unix and UnixWare 7 (and DEC OSF/1 3.2 too) diff --git a/mysys/my_thr_init.c b/mysys/my_thr_init.c index b298c7b1bd7..1f84809e50f 100644 --- a/mysys/my_thr_init.c +++ b/mysys/my_thr_init.c @@ -39,9 +39,6 @@ mysql_mutex_t LOCK_localtime_r; static void install_sigabrt_handler(); #endif - -static uint get_thread_lib(void); - /** True if @c my_thread_global_init() has been called. */ static my_bool my_thread_global_init_done= 0; /* True if THR_KEY_mysys is created */ @@ -96,7 +93,6 @@ static void my_thread_init_internal_mutex(void) mysql_cond_init(key_THR_COND_threads, &THR_COND_threads, NULL); } - void my_thread_destroy_internal_mutex(void) { mysql_mutex_destroy(&THR_LOCK_threads); @@ -190,7 +186,6 @@ my_bool my_thread_global_init(void) if (my_thread_init()) return 1; - thd_lib_detected= get_thread_lib(); my_thread_init_common_mutex(); @@ -455,21 +450,6 @@ safe_mutex_t **my_thread_var_mutex_in_use() return tmp ? &tmp->mutex_in_use : 0; } -static uint get_thread_lib(void) -{ -#ifdef _CS_GNU_LIBPTHREAD_VERSION - char buff[64]; - - confstr(_CS_GNU_LIBPTHREAD_VERSION, buff, sizeof(buff)); - - if (!strncasecmp(buff, "NPTL", 4)) - return THD_LIB_NPTL; - if (!strncasecmp(buff, "linuxthreads", 12)) - return THD_LIB_LT; -#endif - return THD_LIB_OTHER; -} - #ifdef _WIN32 /* In Visual Studio 2005 and later, default SIGABRT handler will overwrite diff --git a/mysys/stacktrace.c b/mysys/stacktrace.c index 19dcdf11dd5..958ca506c59 100644 --- a/mysys/stacktrace.c +++ b/mysys/stacktrace.c @@ -438,8 +438,8 @@ void my_print_stacktrace(uchar* stack_bottom, ulong thread_stack, :"r"(pc)); #endif /* __alpha__ */ - /* We are 1 frame above signal frame with NPTL and 2 frames above with LT */ - sigreturn_frame_count = thd_lib_detected == THD_LIB_LT ? 2 : 1; + /* We are 1 frame above signal frame with NPTL */ + sigreturn_frame_count = 1; while (fp < (uchar**) stack_bottom) { diff --git a/mysys/thr_alarm.c b/mysys/thr_alarm.c index 553dc55bfc3..9bc70b283cb 100644 --- a/mysys/thr_alarm.c +++ b/mysys/thr_alarm.c @@ -95,16 +95,8 @@ void init_thr_alarm(uint max_alarms) sigfillset(&full_signal_set); /* Neaded to block signals */ mysql_mutex_init(key_LOCK_alarm, &LOCK_alarm, MY_MUTEX_INIT_FAST); mysql_cond_init(key_COND_alarm, &COND_alarm, NULL); - if (thd_lib_detected == THD_LIB_LT) - thr_client_alarm= SIGALRM; - else - thr_client_alarm= SIGUSR1; -#ifndef USE_ALARM_THREAD - if (thd_lib_detected != THD_LIB_LT) -#endif - { - my_sigset(thr_client_alarm, thread_alarm); - } + thr_client_alarm= SIGUSR1; + my_sigset(thr_client_alarm, thread_alarm); sigemptyset(&s); sigaddset(&s, THR_SERVER_ALARM); alarm_thread=pthread_self(); @@ -121,11 +113,6 @@ void init_thr_alarm(uint max_alarms) } #elif defined(USE_ONE_SIGNAL_HAND) pthread_sigmask(SIG_BLOCK, &s, NULL); /* used with sigwait() */ - if (thd_lib_detected == THD_LIB_LT) - { - my_sigset(thr_client_alarm, process_alarm); /* Linuxthreads */ - pthread_sigmask(SIG_UNBLOCK, &s, NULL); - } #else my_sigset(THR_SERVER_ALARM, process_alarm); pthread_sigmask(SIG_UNBLOCK, &s, NULL); @@ -286,18 +273,6 @@ sig_handler process_alarm(int sig __attribute__((unused))) This must be first as we can't call DBUG inside an alarm for a normal thread */ - if (thd_lib_detected == THD_LIB_LT && - !pthread_equal(pthread_self(),alarm_thread)) - { -#if defined(MAIN) && !defined(__bsdi__) - printf("thread_alarm in process_alarm\n"); fflush(stdout); -#endif -#ifdef SIGNAL_HANDLER_RESET_ON_DELIVERY - my_sigset(thr_client_alarm, process_alarm); /* int. thread system calls */ -#endif - return; - } - /* We have to do do the handling of the alarm in a sub function, because otherwise we would get problems with two threads calling diff --git a/sql/mysqld.cc b/sql/mysqld.cc index b2f8afca7a6..dfe2c88e975 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -321,10 +321,6 @@ static PSI_rwlock_key key_rwlock_openssl; #endif #endif /* HAVE_PSI_INTERFACE */ -#ifdef HAVE_NPTL -volatile sig_atomic_t ld_assume_kernel_is_set= 0; -#endif - /** Statement instrumentation key for replication. */ @@ -2952,8 +2948,7 @@ void init_signals(void) sa.sa_flags = 0; sa.sa_handler = print_signal_warning; sigaction(SIGHUP, &sa, (struct sigaction*) 0); - if (thd_lib_detected != THD_LIB_LT) - sigaddset(&set,THR_SERVER_ALARM); + sigaddset(&set,THR_SERVER_ALARM); if (test_flags & TEST_SIGINT) { /* Allow SIGINT to break mysqld. This is for debugging with --gdb */ @@ -5335,9 +5330,6 @@ int mysqld_main(int argc, char **argv) if (init_early_variables()) exit(1); -#ifdef HAVE_NPTL - ld_assume_kernel_is_set= (getenv("LD_ASSUME_KERNEL") != 0); -#endif #ifndef _WIN32 // For windows, my_init() is called from the win specific mysqld_main if (my_init()) // init my_sys library & pthreads diff --git a/sql/signal_handler.cc b/sql/signal_handler.cc index 51b9d7a2c51..cbf58bb6e57 100644 --- a/sql/signal_handler.cc +++ b/sql/signal_handler.cc @@ -42,9 +42,6 @@ static volatile sig_atomic_t segfaulted= 0; extern ulong max_used_connections; extern volatile sig_atomic_t calling_initgroups; -#ifdef HAVE_NPTL -extern volatile sig_atomic_t ld_assume_kernel_is_set; -#endif extern const char *optimizer_switch_names[]; @@ -296,21 +293,6 @@ extern "C" sig_handler handle_fatal_signal(int sig) } #endif -#ifdef HAVE_NPTL - if (thd_lib_detected == THD_LIB_LT && !ld_assume_kernel_is_set) - { - my_safe_printf_stderr("%s", - "You are running a statically-linked LinuxThreads binary on an NPTL\n" - "system. This can result in crashes on some distributions due to " - "LT/NPTL conflicts.\n" - "You should either build a dynamically-linked binary, " - "or force LinuxThreads\n" - "to be used with the LD_ASSUME_KERNEL environment variable.\n" - "Please consult the documentation for your distribution " - "on how to do that.\n"); - } -#endif - if (locked_in_memory) { my_safe_printf_stderr("%s", "\n"