Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

data race in GC alloc counters #27173

Closed
vchuravy opened this issue May 19, 2018 · 1 comment
Closed

data race in GC alloc counters #27173

vchuravy opened this issue May 19, 2018 · 1 comment
Labels
GC Garbage collector multithreading Base.Threads and related functionality

Comments

@vchuravy
Copy link
Member

vchuravy commented May 19, 2018

Running under TSAN with JULIA_NUM_THREADS=4 gives the following warning:

WARNING: ThreadSanitizer: data race (pid=32587)
  Write of size 8 at 0x7f82ec049d80 by thread T3:
    #0 jl_gc_pool_alloc /home/vchuravy/src/julia/src/gc.c:959:9 (libjulia.so.0.7+0xc2da4)
    #1 jl_gc_alloc_ /home/vchuravy/src/julia/src/./julia_internal.h:274:13 (libjulia.so.0.7+0x7a031)
    #2 jl_init_root_task /home/vchuravy/src/julia/src/task.c:714 (libjulia.so.0.7+0x7a031)
    #3 ti_threadfun /home/vchuravy/src/julia/src/threading.c:367:5 (libjulia.so.0.7+0xbe187)

  Previous write of size 8 at 0x7f82ec049d80 by thread T2:
    #0 jl_gc_pool_alloc /home/vchuravy/src/julia/src/gc.c:959:9 (libjulia.so.0.7+0xc2da4)
    #1 jl_gc_alloc_ /home/vchuravy/src/julia/src/./julia_internal.h:274:13 (libjulia.so.0.7+0x7a031)
    #2 jl_init_root_task /home/vchuravy/src/julia/src/task.c:714 (libjulia.so.0.7+0x7a031)
    #3 ti_threadfun /home/vchuravy/src/julia/src/threading.c:367:5 (libjulia.so.0.7+0xbe187)

  Location is global 'gc_num' of size 104 at 0x7f82ec049d80 (libjulia.so.0.7+0x00000057fd80)

  Thread T3 (tid=32591, running) created by main thread at:
    #0 pthread_create /home/vchuravy/src/julia/deps/srccache/llvm-6.0.0/projects/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc:992:3 (julia+0x40f766)
    #1 uv_thread_create /home/vchuravy/src/julia/deps/srccache/libuv-be317349252699670131395f125c3861d793ca86/src/unix/thread.c:76:9 (libjulia.so.0.7+0x247f22)
    #2 _julia_init /home/vchuravy/src/julia/src/init.c:726:5 (libjulia.so.0.7+0x768dc)
    #3 julia_init__threading /home/vchuravy/src/julia/src/task.c:302:5 (libjulia.so.0.7+0x79420)
    #4 main /home/vchuravy/src/julia/ui/repl.c:234:5 (julia+0x4994d3)

  Thread T2 (tid=32590, running) created by main thread at:
    #0 pthread_create /home/vchuravy/src/julia/deps/srccache/llvm-6.0.0/projects/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc:992:3 (julia+0x40f766)
    #1 uv_thread_create /home/vchuravy/src/julia/deps/srccache/libuv-be317349252699670131395f125c3861d793ca86/src/unix/thread.c:76:9 (libjulia.so.0.7+0x247f22)
    #2 _julia_init /home/vchuravy/src/julia/src/init.c:726:5 (libjulia.so.0.7+0x768dc)
    #3 julia_init__threading /home/vchuravy/src/julia/src/task.c:302:5 (libjulia.so.0.7+0x79420)
    #4 main /home/vchuravy/src/julia/ui/repl.c:234:5 (julia+0x4994d3)

SUMMARY: ThreadSanitizer: data race /home/vchuravy/src/julia/src/gc.c:959:9 in jl_gc_pool_alloc

--edit: Already has a // FIXME - need JL_ATOMIC_FETCH_AND_ADD here annotation

@vchuravy vchuravy added multithreading Base.Threads and related functionality GC Garbage collector labels May 19, 2018
@yuyichao
Copy link
Contributor

This is real though it shouldn't matter for most purposes ATM. The FIXME note is wrong though. Simply doing it will be way too slow.

@JeffBezanson JeffBezanson changed the title Probably benign datarace in jl_gc_pool_alloc data race in jl_gc_pool_alloc Jun 1, 2019
@JeffBezanson JeffBezanson changed the title data race in jl_gc_pool_alloc data race in GC alloc counters Jun 3, 2019
JeffBezanson added a commit that referenced this issue Jun 4, 2019
JeffBezanson added a commit that referenced this issue Jun 7, 2019
JeffBezanson added a commit that referenced this issue Jun 10, 2019
JeffBezanson added a commit that referenced this issue Jun 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GC Garbage collector multithreading Base.Threads and related functionality
Projects
None yet
Development

No branches or pull requests

3 participants