]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: add race detector tips to reportZombies func
authorLin Lin <linlin152@foxmail.com>
Fri, 15 Nov 2024 12:08:29 +0000 (12:08 +0000)
committerGopher Robot <gobot@golang.org>
Fri, 15 Nov 2024 17:47:27 +0000 (17:47 +0000)
We can find a few issues finally turned out to be a race condition,
such as #47513. I believe such a tip can eliminate the need for developers
to file this kind of issue in the first place.

Change-Id: I1597fa09fde641882e8e87453470941747705272
GitHub-Last-Rev: 9f136f5b3bee78f90f434dcea1cabf397c6c05f2
GitHub-Pull-Request: golang/go#70331
Reviewed-on: https://go-review.googlesource.com/c/go/+/627816
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
src/runtime/mgcsweep.go

index f53330a5b976563764d1600b41a1b09853411ebc..83064e8eeaa2a16f585c5ca41267566be440e61a 100644 (file)
@@ -855,7 +855,7 @@ func (sl *sweepLocked) sweep(preserve bool) bool {
 // pointer to that object and marked it.
 func (s *mspan) reportZombies() {
        printlock()
-       print("runtime: marked free object in span ", s, ", elemsize=", s.elemsize, " freeindex=", s.freeindex, " (bad use of unsafe.Pointer? try -d=checkptr)\n")
+       print("runtime: marked free object in span ", s, ", elemsize=", s.elemsize, " freeindex=", s.freeindex, " (bad use of unsafe.Pointer or having race conditions? try -d=checkptr or -race)\n")
        mbits := s.markBitsForBase()
        abits := s.allocBitsForIndex(0)
        for i := uintptr(0); i < uintptr(s.nelems); i++ {