[compiler-rt] r204809 - tsan: fix deadlock during fork

Dmitry Vyukov dvyukov at google.com
Wed Mar 26 08:58:18 PDT 2014


Hi Matheus,

Unfortunately we have episodic flakes in tsan tests due to unfortunate timings.
Should be fixed by r204824.




On Wed, Mar 26, 2014 at 7:13 PM, Matheus Almeida
<Matheus.Almeida at imgtec.com> wrote:
> Hi Dmitry,
>
> Is it possible that one of your recent changes broke ThreadSanitizer :: halt_on_error.cc ?
> The buildbot is blaming me but I didn't touch compiler-rt nor any of the sanitizers.
>
> The error message is:
>
> ******************** TEST 'ThreadSanitizer :: halt_on_error.cc' FAILED ********************
> Script:
> --
> /home/llvmbb/llvm-build-dir/llvm-clang-lld-x86_64-ubuntu-13.04/llvm.obj/./bin/clang -fsanitize=thread -g -Wall -lpthread -ldl -m64 -O1 /home/llvmbb/llvm-build-dir/llvm-clang-lld-x86_64-ubuntu-13.04/llvm.src/projects/compiler-rt/test/tsan/halt_on_error.cc -o /home/llvmbb/llvm-build-dir/llvm-clang-lld-x86_64-ubuntu-13.04/llvm.obj/projects/compiler-rt/test/tsan/Output/halt_on_error.cc.tmp && TSAN_OPTIONS="$TSAN_OPTIONS halt_on_error=1" not /home/llvmbb/llvm-build-dir/llvm-clang-lld-x86_64-ubuntu-13.04/llvm.obj/projects/compiler-rt/test/tsan/Output/halt_on_error.cc.tmp 2>&1 | FileCheck /home/llvmbb/llvm-build-dir/llvm-clang-lld-x86_64-ubuntu-13.04/llvm.src/projects/compiler-rt/test/tsan/halt_on_error.cc
> --
> Exit Code: 1
>
> Command Output (stderr):
> --
> /home/llvmbb/llvm-build-dir/llvm-clang-lld-x86_64-ubuntu-13.04/llvm.src/projects/compiler-rt/test/tsan/halt_on_error.cc:23:11: error: expected string not found in input
> // CHECK: WARNING: ThreadSanitizer: data race
>           ^
> <stdin>:2:1: note: scanning from here
> AFTER
> ^
>
> Regards,
> Matheus
>
> -----Original Message-----
> From: llvm-commits-bounces at cs.uiuc.edu [mailto:llvm-commits-bounces at cs.uiuc.edu] On Behalf Of Dmitry Vyukov
> Sent: 26 March 2014 14:14
> To: llvm-commits at cs.uiuc.edu
> Subject: [compiler-rt] r204809 - tsan: fix deadlock during fork
>
> Author: dvyukov
> Date: Wed Mar 26 09:13:31 2014
> New Revision: 204809
>
> URL: http://llvm.org/viewvc/llvm-project?rev=204809&view=rev
> Log:
> tsan: fix deadlock during fork
> ReportRace takes the two mutexes in the opposite order
>
>
> Modified:
>     compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.cc
>
> Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.cc
> URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.cc?rev=204809&r1=204808&r2=204809&view=diff
> ==============================================================================
> --- compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.cc (original)
> +++ compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.cc Wed Mar 26 09:13:31 2014
> @@ -324,18 +324,18 @@ int Finalize(ThreadState *thr) {
>
>  #ifndef TSAN_GO
>  void ForkBefore(ThreadState *thr, uptr pc) {
> -  ctx->report_mtx.Lock();
>    ctx->thread_registry->Lock();
> +  ctx->report_mtx.Lock();
>  }
>
>  void ForkParentAfter(ThreadState *thr, uptr pc) {
> -  ctx->thread_registry->Unlock();
>    ctx->report_mtx.Unlock();
> +  ctx->thread_registry->Unlock();
>  }
>
>  void ForkChildAfter(ThreadState *thr, uptr pc) {
> -  ctx->thread_registry->Unlock();
>    ctx->report_mtx.Unlock();
> +  ctx->thread_registry->Unlock();
>
>    uptr nthread = 0;
>    ctx->thread_registry->GetNumberOfThreads(0, 0, &nthread /* alive threads */);
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list