Skip to content

Data race in CAF blackholing?

While looking at #20093 (closed) I noticed:

Actual stderr output differs from expected:
--- /dev/null   2021-07-12 09:54:50.852065245 -0400
+++ "/run/user/1000/ghctest-ecnt2p9d/test   spaces/testsuite/tests/concurrent/should_run/T5558.run/T5558.run.stderr.normalised" 2021-07-16 14:07:59.138319164 -0400
@@ -0,0 +1,45 @@
+==================
+WARNING: ThreadSanitizer: data race (pid=743565)
+  Atomic read of size 8 at 0x7eb90f409808 by thread T6:
+    #0 __tsan_atomic64_load <null> (libtsan.so.0+0x67489)
+    #1 messageBlackHole rts/Messages.c:188 (T5558+0x7c4174)
+    #2 stg_BLACKHOLE_info <null> (T5558+0x7b12e9)
+    #3 scheduleWorker rts/Schedule.c:2668 (T5558+0x77322f)
+    #4 workerStart rts/Task.c:445 (T5558+0x77a976)
+    #5 <null> <null> (libtsan.so.0+0x2e0b6)
+
+  Previous write of size 8 at 0x7eb90f409808 by thread T5:
+    #0 lockCAF rts/sm/Storage.c:578 (T5558+0x7a5469)
+    #1 newCAF rts/sm/Storage.c:594 (T5558+0x7a5469)
+    #2 Main_lock_info <null> (T5558+0x4158a4)
+    #3 scheduleWorker rts/Schedule.c:2668 (T5558+0x77322f)
+    #4 workerStart rts/Task.c:445 (T5558+0x77a976)
+    #5 <null> <null> (libtsan.so.0+0x2e0b6)
+
+  Thread T6 (tid=743572, running) created by thread T4 at:
+    #0 pthread_create <null> (libtsan.so.0+0x3055b)
+    #1 createOSThread rts/posix/OSThreads.c:166 (T5558+0x7a9a1f)
+    #2 startWorkerTask rts/Task.c:497 (T5558+0x77b3ca)
+    #3 releaseCapability_ rts/Capability.c:588 (T5558+0x761e37)
+    #4 suspendThread rts/Schedule.c:2502 (T5558+0x7728e3)
+    #5 <null> <null> (T5558+0x6c2c2a)
+    #6 scheduleWorker rts/Schedule.c:2668 (T5558+0x77322f)
+    #7 workerStart rts/Task.c:445 (T5558+0x77a976)
+    #8 <null> <null> (libtsan.so.0+0x2e0b6)
+
+  Thread T5 (tid=743571, running) created by main thread at:
+    #0 pthread_create <null> (libtsan.so.0+0x3055b)
+    #1 createOSThread rts/posix/OSThreads.c:166 (T5558+0x7a9a1f)
+    #2 startWorkerTask rts/Task.c:497 (T5558+0x77b3ca)
+    #3 releaseCapability_ rts/Capability.c:588 (T5558+0x761e37)
+    #4 yieldCapability rts/Capability.c:1007 (T5558+0x7623f2)
+    #5 scheduleYield rts/Schedule.c:705 (T5558+0x7708c2)
+    #6 schedule rts/Schedule.c:315 (T5558+0x7708c2)
+    #7 scheduleWaitThread rts/Schedule.c:2651 (T5558+0x7731af)
+    #8 rts_evalLazyIO rts/RtsAPI.c:566 (T5558+0x7c9dc3)
+    #9 hs_main rts/RtsMain.c:72 (T5558+0x76a125)
+    #10 main <null> (T5558+0x415f21)
+
+SUMMARY: ThreadSanitizer: data race (/nix/store/vran8acwir59772hj4vscr7zribvp7l5-gcc-9.3.0-lib/lib/libtsan.so.0+0x67489) in __tsan_atomic64_load

I don't yet understand what is going on here.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information