Skip to content

Instantly share code, notes, and snippets.

@jepler
Created October 21, 2019 12:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jepler/96ac702a5159b0ec95f1cffb72cfad68 to your computer and use it in GitHub Desktop.
Save jepler/96ac702a5159b0ec95f1cffb72cfad68 to your computer and use it in GitHub Desktop.
-fsanitize=thread error in circuitpython's unix testsuite
WARNING: ThreadSanitizer: data race (pid=7514)
Read of size 1 at 0x7fcf91400017 by thread T2:
#0 gc_mark ../../py/gc.c:352 (micropython+0x19666)
#1 gc_mark ../../py/gc.c:349 (micropython+0x19666)
#2 gc_collect_root ../../py/gc.c:393 (micropython+0x19666)
#3 gc_collect_regs_and_stack /home/jepler/src/circuitpython/ports/unix/gccollect.c:159 (micropython+0x73072)
#4 mp_thread_gc /home/jepler/src/circuitpython/ports/unix/mpthreadport.c:65 (micropython+0x7351e)
#5 <null> <null> (libtsan.so.0+0x28c0f)
#6 array_append ../../py/objarray.c:356 (micropython+0x43fce)
#7 array_construct ../../py/objarray.c:149 (micropython+0x44e70)
#8 bytearray_make_new ../../py/objarray.c:193 (micropython+0x44f77)
#9 type_call ../../py/objtype.c:1038 (micropython+0x59758)
#10 mp_call_function_n_kw ../../py/runtime.c:624 (micropython+0x3ea05)
#11 mp_execute_bytecode ../../py/vm.c:932 (micropython+0x63bbc)
#12 fun_bc_call ../../py/objfun.c:284 (micropython+0x4a7d6)
#13 mp_call_function_n_kw ../../py/runtime.c:624 (micropython+0x3ea05)
#14 thread_entry ../../py/modthread.c:193 (micropython+0x62820)
#15 <null> <null> (libtsan.so.0+0x29b3d)
Previous write of size 1 at 0x7fcf91400017 by thread T3 (mutexes: write M8):
#0 gc_mark_subtree ../../py/gc.c:251 (micropython+0x1902b)
#1 gc_mark ../../py/gc.c:356 (micropython+0x1959c)
#2 gc_mark ../../py/gc.c:349 (micropython+0x1959c)
#3 gc_collect_root ../../py/gc.c:393 (micropython+0x1959c)
#4 gc_collect_start ../../py/gc.c:375 (micropython+0x1959c)
#5 gc_collect /home/jepler/src/circuitpython/ports/unix/gccollect.c:165 (micropython+0x73091)
#6 py_gc_collect ../../py/modgc.c:35 (micropython+0x60239)
#7 fun_builtin_0_call ../../py/objfun.c:56 (micropython+0x4a306)
#8 mp_call_function_n_kw ../../py/runtime.c:624 (micropython+0x3ea05)
#9 mp_call_method_n_kw ../../py/runtime.c:639 (micropython+0x3ec81)
#10 mp_execute_bytecode ../../py/vm.c:1015 (micropython+0x63ad9)
#11 fun_bc_call ../../py/objfun.c:284 (micropython+0x4a7d6)
#12 mp_call_function_n_kw ../../py/runtime.c:624 (micropython+0x3ea05)
#13 thread_entry ../../py/modthread.c:193 (micropython+0x62820)
#14 <null> <null> (libtsan.so.0+0x29b3d)
Location is heap block of size 2097152 at 0x7fcf91400000 allocated by main thread:
#0 malloc <null> (libtsan.so.0+0x2b1a3)
#1 main_ /home/jepler/src/circuitpython/ports/unix/main.c:442 (micropython+0x72662)
#2 main /home/jepler/src/circuitpython/ports/unix/main.c:419 (micropython+0x72ee9)
Mutex M8 (0x55c08aea2c68) created at:
#0 pthread_mutex_init <null> (libtsan.so.0+0x2c5ad)
#1 mp_thread_mutex_init /home/jepler/src/circuitpython/ports/unix/mpthreadport.c:206 (micropython+0x73a03)
#2 gc_init ../../py/gc.c:176 (micropython+0x19275)
#3 main_ /home/jepler/src/circuitpython/ports/unix/main.c:443 (micropython+0x72673)
#4 main /home/jepler/src/circuitpython/ports/unix/main.c:419 (micropython+0x72ee9)
Thread T2 (tid=7517, running) created by main thread at:
#0 pthread_create <null> (libtsan.so.0+0x2be1b)
#1 mp_thread_create /home/jepler/src/circuitpython/ports/unix/mpthreadport.c:167 (micropython+0x7389b)
#2 mod_thread_start_new_thread ../../py/modthread.c:269 (micropython+0x62ad2)
#3 fun_builtin_var_call ../../py/objfun.c:127 (micropython+0x4a60a)
#4 mp_call_function_n_kw ../../py/runtime.c:624 (micropython+0x3ea05)
#5 mp_call_method_n_kw ../../py/runtime.c:639 (micropython+0x3ec81)
#6 mp_execute_bytecode ../../py/vm.c:1015 (micropython+0x63ad9)
#7 fun_bc_call ../../py/objfun.c:284 (micropython+0x4a7d6)
#8 mp_call_function_n_kw ../../py/runtime.c:624 (micropython+0x3ea05)
#9 mp_call_function_0 ../../py/runtime.c:598 (micropython+0x3ea65)
#10 execute_from_lexer /home/jepler/src/circuitpython/ports/unix/main.c:145 (micropython+0x72280)
#11 do_file /home/jepler/src/circuitpython/ports/unix/main.c:297 (micropython+0x723f9)
#12 main_ /home/jepler/src/circuitpython/ports/unix/main.c:637 (micropython+0x72cfd)
#13 main /home/jepler/src/circuitpython/ports/unix/main.c:419 (micropython+0x72ee9)
Thread T3 (tid=7518, running) created by main thread at:
#0 pthread_create <null> (libtsan.so.0+0x2be1b)
#1 mp_thread_create /home/jepler/src/circuitpython/ports/unix/mpthreadport.c:167 (micropython+0x7389b)
#2 mod_thread_start_new_thread ../../py/modthread.c:269 (micropython+0x62ad2)
#3 fun_builtin_var_call ../../py/objfun.c:127 (micropython+0x4a60a)
#4 mp_call_function_n_kw ../../py/runtime.c:624 (micropython+0x3ea05)
#5 mp_call_method_n_kw ../../py/runtime.c:639 (micropython+0x3ec81)
#6 mp_execute_bytecode ../../py/vm.c:1015 (micropython+0x63ad9)
#7 fun_bc_call ../../py/objfun.c:284 (micropython+0x4a7d6)
#8 mp_call_function_n_kw ../../py/runtime.c:624 (micropython+0x3ea05)
#9 mp_call_function_0 ../../py/runtime.c:598 (micropython+0x3ea65)
#10 execute_from_lexer /home/jepler/src/circuitpython/ports/unix/main.c:145 (micropython+0x72280)
#11 do_file /home/jepler/src/circuitpython/ports/unix/main.c:297 (micropython+0x723f9)
#12 main_ /home/jepler/src/circuitpython/ports/unix/main.c:637 (micropython+0x72cfd)
#13 main /home/jepler/src/circuitpython/ports/unix/main.c:419 (micropython+0x72ee9)
SUMMARY: ThreadSanitizer: data race ../../py/gc.c:352 in gc_mark
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment