• Kirill Smelkov's avatar
    X tracing: Silence race-detector about probe.Detach · bab79665
    Kirill Smelkov authored
    Race-detector does not know Probe.Detach works under world stopped and
    that this way it cannot break consistency of probes list attached to a
    trace event - on event signalling either a probe will be run or not run
    at all.
    
    And we do not mind that e.g. while Detach was in progress a probe was
    was read from traceevent list and deceded to be run and the probe
    function was actually called just after Detach finished.
    
    For this reason tell race-detector to not take into account all memory
    read/write that are performed while the world is stopped.
    
    If we do not it complains e.g. this way:
    
        ==================
        WARNING: DATA RACE
        Read at 0x00c42000d760 by goroutine 7:
          lab.nexedi.com/kirr/neo/go/zodb/storage._traceCacheGCFinish_run()
              /home/kirr/src/neo/src/lab.nexedi.com/kirr/neo/go/xcommon/tracing/tracing.go:265 +0x81
          lab.nexedi.com/kirr/neo/go/zodb/storage.traceCacheGCFinish()
              /home/kirr/src/neo/src/lab.nexedi.com/kirr/neo/go/zodb/storage/ztrace.go:22 +0x63
          lab.nexedi.com/kirr/neo/go/zodb/storage.(*Cache).gc()
              /home/kirr/src/neo/src/lab.nexedi.com/kirr/neo/go/zodb/storage/cache.go:497 +0x62c
          lab.nexedi.com/kirr/neo/go/zodb/storage.(*Cache).gcmain()
              /home/kirr/src/neo/src/lab.nexedi.com/kirr/neo/go/zodb/storage/cache.go:478 +0x4c
    
        Previous write at 0x00c42000d760 by goroutine 6:
          lab.nexedi.com/kirr/neo/go/xcommon/tracing.(*Probe).Detach()
              /home/kirr/src/neo/src/lab.nexedi.com/kirr/neo/go/xcommon/tracing/tracing.go:319 +0x103
          lab.nexedi.com/kirr/neo/go/xcommon/tracing.(*ProbeGroup).Done()
              /home/kirr/src/neo/src/lab.nexedi.com/kirr/neo/go/xcommon/tracing/tracing.go:344 +0xa5
          lab.nexedi.com/kirr/neo/go/zodb/storage.TestCache()
              /home/kirr/src/neo/src/lab.nexedi.com/kirr/neo/go/zodb/storage/cache_test.go:576 +0x7f94
          testing.tRunner()
              /home/kirr/src/tools/go/go/src/testing/testing.go:746 +0x16c
    
        Goroutine 7 (running) created at:
          lab.nexedi.com/kirr/neo/go/zodb/storage.NewCache()
              /home/kirr/src/neo/src/lab.nexedi.com/kirr/neo/go/zodb/storage/cache.go:129 +0x227
          lab.nexedi.com/kirr/neo/go/zodb/storage.TestCache()
              /home/kirr/src/neo/src/lab.nexedi.com/kirr/neo/go/zodb/storage/cache_test.go:165 +0x7b1
          testing.tRunner()
              /home/kirr/src/tools/go/go/src/testing/testing.go:746 +0x16c
    
        Goroutine 6 (finished) created at:
          testing.(*T).Run()
              /home/kirr/src/tools/go/go/src/testing/testing.go:789 +0x568
          testing.runTests.func1()
              /home/kirr/src/tools/go/go/src/testing/testing.go:1004 +0xa7
          testing.tRunner()
              /home/kirr/src/tools/go/go/src/testing/testing.go:746 +0x16c
          testing.runTests()
              /home/kirr/src/tools/go/go/src/testing/testing.go:1002 +0x521
          testing.(*M).Run()
              /home/kirr/src/tools/go/go/src/testing/testing.go:921 +0x206
          main.main()
              lab.nexedi.com/kirr/neo/go/zodb/storage/_test/_testmain.go:44 +0x1d3
        ==================
    bab79665
zruntime_g_go1.9.go 5.11 KB