Skip to content

Instantly share code, notes, and snippets.

@fmeyer
Created June 19, 2020 07:03
Show Gist options
  • Save fmeyer/7c5f05eb90d1a367d18018fecb2b5275 to your computer and use it in GitHub Desktop.
Save fmeyer/7c5f05eb90d1a367d18018fecb2b5275 to your computer and use it in GitHub Desktop.
Test sanitizer race condition
##### ../misc/cgo/testsanitizers
--- FAIL: TestShared (0.03s)
--- FAIL: TestShared/tsan_shared (2.19s)
cshared_test.go:71: `/tmp/TestShared464897178/tsan_shared` exited with exit status 66
==================
WARNING: ThreadSanitizer: data race (pid=146300)
Write of size 8 at 0x7fc3bfc95c10 by thread T1:
#0 pthread_attr_getstacksize <null> (tsan_shared+0x00000041d5c2)
#1 x_cgo_init <null> (libtsan_shared.so+0x000000098a15)
#2 runtime.rt0_go <null> (libtsan_shared.so+0x00000008fad9)
Previous write of size 8 at 0x7fc3bfc95c10 by main thread:
#0 <null> <null> (0x000000000001)
Location is stack of thread T1.
Thread T1 (tid=146302, running) created by main thread at:
#0 pthread_create <null> (tsan_shared+0x00000040ded4)
#1 _cgo_try_pthread_create <null> (libtsan_shared.so+0x0000000988ce)
#2 x_cgo_sys_thread_create <null> (libtsan_shared.so+0x000000098670)
#3 _rt0_amd64_lib <null> (libtsan_shared.so+0x00000008f9c6)
SUMMARY: ThreadSanitizer: data race ??:0 __interceptor_pthread_attr_getstacksize
==================
==================
WARNING: ThreadSanitizer: data race (pid=146300)
Read of size 8 at 0x7d080000dfe0 by thread T2:
#0 threadentry <null> (libtsan_shared.so+0x000000098c01)
Previous write of size 8 at 0x7d080000dfe0 by thread T1:
#0 malloc <null> (tsan_shared+0x00000040c2e3)
#1 x_cgo_thread_start <null> (libtsan_shared.so+0x000000099279)
#2 runtime.asmcgocall <null> (libtsan_shared.so+0x000000091686)
Location is heap block of size 24 at 0x7d080000dfe0 allocated by thread T1:
#0 malloc <null> (tsan_shared+0x00000040c2e3)
#1 x_cgo_thread_start <null> (libtsan_shared.so+0x000000099279)
#2 runtime.asmcgocall <null> (libtsan_shared.so+0x000000091686)
Thread T2 (tid=146303, running) created by thread T1 at:
#0 pthread_create <null> (tsan_shared+0x00000040ded4)
#1 _cgo_try_pthread_create <null> (libtsan_shared.so+0x0000000988ce)
#2 _cgo_sys_thread_start <null> (libtsan_shared.so+0x000000098b85)
#3 x_cgo_thread_start <null> (libtsan_shared.so+0x000000099307)
#4 runtime.asmcgocall <null> (libtsan_shared.so+0x000000091686)
Thread T1 (tid=146302, running) created by main thread at:
#0 pthread_create <null> (tsan_shared+0x00000040ded4)
#1 _cgo_try_pthread_create <null> (libtsan_shared.so+0x0000000988ce)
#2 x_cgo_sys_thread_create <null> (libtsan_shared.so+0x000000098670)
#3 _rt0_amd64_lib <null> (libtsan_shared.so+0x00000008f9c6)
SUMMARY: ThreadSanitizer: data race ??:0 threadentry
==================
==================
WARNING: ThreadSanitizer: data race (pid=146300)
Read of size 8 at 0x7fc3c1c8d4b8 by thread T2:
#0 threadentry <null> (libtsan_shared.so+0x000000098c34)
Previous write of size 8 at 0x7fc3c1c8d4b8 by thread T1:
#0 x_cgo_init <null> (libtsan_shared.so+0x0000000989a9)
#1 runtime.rt0_go <null> (libtsan_shared.so+0x00000008fad9)
Location is global 'setg_gcc' of size 8 at 0x7fc3c1c8d4b8 (libtsan_shared.so+0x0000001404b8)
Thread T2 (tid=146303, running) created by thread T1 at:
#0 pthread_create <null> (tsan_shared+0x00000040ded4)
#1 _cgo_try_pthread_create <null> (libtsan_shared.so+0x0000000988ce)
#2 _cgo_sys_thread_start <null> (libtsan_shared.so+0x000000098b85)
#3 x_cgo_thread_start <null> (libtsan_shared.so+0x000000099307)
#4 runtime.asmcgocall <null> (libtsan_shared.so+0x000000091686)
Thread T1 (tid=146302, running) created by main thread at:
#0 pthread_create <null> (tsan_shared+0x00000040ded4)
#1 _cgo_try_pthread_create <null> (libtsan_shared.so+0x0000000988ce)
#2 x_cgo_sys_thread_create <null> (libtsan_shared.so+0x000000098670)
#3 _rt0_amd64_lib <null> (libtsan_shared.so+0x00000008f9c6)
SUMMARY: ThreadSanitizer: data race ??:0 threadentry
==================
==================
WARNING: ThreadSanitizer: data race (pid=146300)
Read of size 8 at 0x7d080000df80 by thread T6:
#0 threadentry <null> (libtsan_shared.so+0x000000098c01)
Previous write of size 8 at 0x7d080000df80 by thread T1:
#0 malloc <null> (tsan_shared+0x00000040c2e3)
#1 x_cgo_thread_start <null> (libtsan_shared.so+0x000000099279)
#2 runtime.asmcgocall <null> (libtsan_shared.so+0x000000091647)
Location is heap block of size 24 at 0x7d080000df80 allocated by thread T1:
#0 malloc <null> (tsan_shared+0x00000040c2e3)
#1 x_cgo_thread_start <null> (libtsan_shared.so+0x000000099279)
#2 runtime.asmcgocall <null> (libtsan_shared.so+0x000000091647)
Thread T6 (tid=146307, running) created by thread T1 at:
#0 pthread_create <null> (tsan_shared+0x00000040ded4)
#1 _cgo_try_pthread_create <null> (libtsan_shared.so+0x0000000988ce)
#2 _cgo_sys_thread_start <null> (libtsan_shared.so+0x000000098b85)
#3 x_cgo_thread_start <null> (libtsan_shared.so+0x000000099307)
#4 runtime.asmcgocall <null> (libtsan_shared.so+0x000000091647)
Thread T1 (tid=146302, running) created by main thread at:
#0 pthread_create <null> (tsan_shared+0x00000040ded4)
#1 _cgo_try_pthread_create <null> (libtsan_shared.so+0x0000000988ce)
#2 x_cgo_sys_thread_create <null> (libtsan_shared.so+0x000000098670)
#3 _rt0_amd64_lib <null> (libtsan_shared.so+0x00000008f9c6)
SUMMARY: ThreadSanitizer: data race ??:0 threadentry
==================
ThreadSanitizer: reported 4 warnings
FAIL
go tool dist: Failed: exit status 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment