From d8e271ea8ab4477fc3ac8edb884bbf858d401343 Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Thu, 23 Nov 2017 02:19:30 +0300 Subject: [PATCH] Workaround TSan hang in GC_free_inner when called from at-fork handler * pthread_support.c [CAN_HANDLE_FORK] (GC_remove_all_threads_but_me): Do not call GC_INTERNAL_FREE(p) if THREAD_SANITIZER; add comment. --- pthread_support.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pthread_support.c b/pthread_support.c index 70b512af..c70ab7da 100644 --- a/pthread_support.c +++ b/pthread_support.c @@ -787,7 +787,11 @@ STATIC void GC_remove_all_threads_but_me(void) GC_remove_specific_after_fork(GC_thread_key, p -> id); } # endif - if (p != &first_thread) GC_INTERNAL_FREE(p); + /* TODO: To avoid TSan hang (when updating GC_bytes_freed), */ + /* we just skip explicit free of GC_threads entries for now. */ +# ifndef THREAD_SANITIZER + if (p != &first_thread) GC_INTERNAL_FREE(p); +# endif } } GC_threads[hv] = me; -- 2.40.0