summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorunknown <rafal@quant.(none)>2006-12-08 11:41:12 +0100
committerunknown <rafal@quant.(none)>2006-12-08 11:41:12 +0100
commit9f37ea459c214e047fe7b0bea77d52e1027dec91 (patch)
tree6702b694b87c0c4963a83e478d5b342845c9f240 /include
parent00fec63a38f90d873a18e849cf0dc191d1ad42eb (diff)
downloadmariadb-git-9f37ea459c214e047fe7b0bea77d52e1027dec91.tar.gz
BUG#24507 (rpl_log.test crash slave):
The problem was located to lie inside current NPTL pthread_exit() implementation. Race conditions in this code can lead to segmentation fault. Hovewer, this can happen only in a race between first thread calling pthread_exit() and other threads. Workaround implemented in this patch spawns a dummy thread, which exits immediately, during thread lib initialization. This will exclude segment violations when further threads exit. include/my_pthread.h: define macro NPTL_PTHREAD_EXIT_BUG which controls whether workaround in my_thread_global_init() is included or not. mysys/my_thr_init.c: Spawn a dummy thread in my_thread_global_init() to initialize pthread lib internal variables.
Diffstat (limited to 'include')
-rw-r--r--include/my_pthread.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/include/my_pthread.h b/include/my_pthread.h
index 3e4388413e0..8051d75c59e 100644
--- a/include/my_pthread.h
+++ b/include/my_pthread.h
@@ -31,6 +31,26 @@ extern "C" {
#define EXTERNC
#endif /* __cplusplus */
+/*
+ BUG#24507: Race conditions inside current NPTL pthread_exit() implementation.
+
+ If macro NPTL_PTHREAD_EXIT_HACK is defined then a hack described in the bug
+ report will be implemented inside my_thread_global_init() in my_thr_init.c.
+
+ This amounts to spawning a dummy thread which does nothing but executes
+ pthread_exit(0).
+
+ This bug is fixed in version 2.5 of glibc library.
+
+ TODO: Remove this code when fixed versions of glibc6 are in common use.
+ */
+
+#if defined(TARGET_OS_LINUX) && defined(HAVE_NPTL) &&
+ defined(__GLIBC__) && ( __GLIBC__ < 2 || __GLIBC__ == 2 && __GLIBC_MINOR__ < 5 )
+#define NPTL_PTHREAD_EXIT_BUG 1
+#endif
+
+
#if defined(__WIN__) || defined(OS2)
#ifdef OS2