packages: mysql/mysql-fix-dummy-thread-race-condition.patch (NEW) - fixing ...

glen glen at pld-linux.org
Tue Oct 27 13:34:19 CET 2009


Author: glen                         Date: Tue Oct 27 12:34:19 2009 GMT
Module: packages                      Tag: HEAD
---- Log message:
- fixing php-cli with php-mysql ext segfault:
   https://bugs.launchpad.net/mysql-server/+bug/343870

---- Files affected:
packages/mysql:
   mysql-fix-dummy-thread-race-condition.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: packages/mysql/mysql-fix-dummy-thread-race-condition.patch
diff -u /dev/null packages/mysql/mysql-fix-dummy-thread-race-condition.patch:1.1
--- /dev/null	Tue Oct 27 13:34:19 2009
+++ packages/mysql/mysql-fix-dummy-thread-race-condition.patch	Tue Oct 27 13:34:13 2009
@@ -0,0 +1,64 @@
+## fix-dummy-thread-race-condition.dpatch by  <mkoegler at auto.tuwien.ac.at>
+##
+## Avoid dummy thread for pthread_exit workaround
+
+--- mysql-5.0.87/mysys/my_thr_init.c~	2009-10-27 13:28:45.000000000 +0200
++++ mysql-5.0.87/mysys/my_thr_init.c	2009-10-27 13:29:49.502552171 +0200
+@@ -47,23 +47,6 @@
+ pthread_mutexattr_t my_errorcheck_mutexattr;
+ #endif
+ 
+-#ifdef TARGET_OS_LINUX
+-
+-/*
+- Dummy thread spawned in my_thread_global_init() below to avoid
+- race conditions in NPTL pthread_exit code.
+-*/
+-
+-static pthread_handler_t
+-nptl_pthread_exit_hack_handler(void *arg __attribute__((unused)))
+-{
+-  /* Do nothing! */
+-  pthread_exit(0);
+-  return 0;
+-}
+-
+-#endif /* TARGET_OS_LINUX */
+-
+ static uint get_thread_lib(void);
+ 
+ /*
+@@ -71,33 +71,6 @@
+     return 1;
+   }
+ 
+-#ifdef TARGET_OS_LINUX
+-  /*
+-    BUG#24507: Race conditions inside current NPTL pthread_exit()
+-    implementation.
+-
+-    To avoid a possible segmentation fault during concurrent
+-    executions of pthread_exit(), a dummy thread is spawned which
+-    initializes internal variables of pthread lib. See bug description
+-    for a full explanation.
+-
+-    TODO: Remove this code when fixed versions of glibc6 are in common
+-    use.
+-  */
+-  if (thd_lib_detected == THD_LIB_NPTL)
+-  {
+-    pthread_t       dummy_thread;
+-    pthread_attr_t  dummy_thread_attr;
+-
+-    pthread_attr_init(&dummy_thread_attr);
+-    pthread_attr_setdetachstate(&dummy_thread_attr, PTHREAD_CREATE_JOINABLE);
+-
+-    if (pthread_create(&dummy_thread,&dummy_thread_attr,
+-                       nptl_pthread_exit_hack_handler, NULL) == 0)
+-      (void)pthread_join(dummy_thread, NULL);
+-  }
+-#endif /* TARGET_OS_LINUX */
+-
+ #ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
+   /*
+     Set mutex type to "fast" a.k.a "adaptive"
================================================================


More information about the pld-cvs-commit mailing list