mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
Added VALGRIND_YIELD to be able to abort from busy loops
Valgrind is single threaded and only changes threads as part of system calls or waits. I found some busy loops where the server assumes that some other thread will change the state, which will not happen with valgrind. Added VALGRIND_YIELD to the loops, which calls pthread_yield() if HAVE_VALGRIND is defined. Added pthread_yield() to the loops in table_cache. We should consider changing some of the VALGRIND_YIELD calls to call pthread_yield() as busy loop without any sleep() is usually a bad thing. Reviewer: svojtovich@gmail.com
This commit is contained in:
@@ -42,6 +42,7 @@
|
||||
# else
|
||||
# define MSAN_STAT_WORKAROUND(st) ((void) 0)
|
||||
# endif
|
||||
# define VALGRIND_YIELD
|
||||
#elif defined(HAVE_VALGRIND_MEMCHECK_H) && defined(HAVE_valgrind)
|
||||
# include <valgrind/memcheck.h>
|
||||
# define HAVE_MEM_CHECK
|
||||
@@ -55,6 +56,7 @@
|
||||
# define MEM_SET_VBITS(a,b,len) VALGRIND_SET_VBITS(a,b,len)
|
||||
# define REDZONE_SIZE 8
|
||||
# define MSAN_STAT_WORKAROUND(st) ((void) 0)
|
||||
# define VALGRIND_YIELD pthread_yield()
|
||||
#elif defined(__SANITIZE_ADDRESS__) && (!defined(_MSC_VER) || defined (__clang__))
|
||||
# include <sanitizer/asan_interface.h>
|
||||
/* How to do manual poisoning:
|
||||
@@ -70,6 +72,7 @@ https://github.com/google/sanitizers/wiki/AddressSanitizerManualPoisoning */
|
||||
# define MEM_SET_VBITS(a,b,len) ((void) 0)
|
||||
# define MSAN_STAT_WORKAROUND(st) ((void) 0)
|
||||
# define REDZONE_SIZE 8
|
||||
# define VALGRIND_YIELD
|
||||
#else
|
||||
# define MEM_UNDEFINED(a,len) ((void) 0)
|
||||
# define MEM_MAKE_ADDRESSABLE(a,len) ((void) 0)
|
||||
@@ -81,6 +84,7 @@ https://github.com/google/sanitizers/wiki/AddressSanitizerManualPoisoning */
|
||||
# define MEM_SET_VBITS(a,b,len) ((void) 0)
|
||||
# define REDZONE_SIZE 0
|
||||
# define MSAN_STAT_WORKAROUND(st) ((void) 0)
|
||||
# define VALGRIND_YIELD
|
||||
#endif /* __has_feature(memory_sanitizer) */
|
||||
|
||||
#ifdef TRASH_FREED_MEMORY
|
||||
|
Reference in New Issue
Block a user