From: Ivan Maidanski Date: Fri, 15 Dec 2017 07:15:05 +0000 (+0300) Subject: Workaround TSan hang in free_inner when called from at-fork child handler X-Git-Tag: v8.0.0~446 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=15be5550428692304d0f35c62145030d17fc3b1b;p=platform%2Fupstream%2Flibgc.git Workaround TSan hang in free_inner when called from at-fork child handler * pthread_support.c [CAN_HANDLE_FORK] (GC_remove_all_threads_but_me): Do not call GC_INTERNAL_FREE(p) if THREAD_SANITIZER and CAN_CALL_ATFORK; add comment. --- diff --git a/pthread_support.c b/pthread_support.c index ae262fd..bb8a0d5 100644 --- a/pthread_support.c +++ b/pthread_support.c @@ -801,7 +801,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 freeing of GC_threads entries. */ +# if !defined(THREAD_SANITIZER) || !defined(CAN_CALL_ATFORK) + if (p != &first_thread) GC_INTERNAL_FREE(p); +# endif } } store_to_threads_table(hv, me);