Skip to content

Commit

Permalink
client/pkg/testutil: update interestingGoroutines
Browse files Browse the repository at this point in the history
The Go runtime uses runtime Finalizer to delete cert [[1]]. The
interestingGoroutines is able to collect stack like,

```plain
leak.go:103: Found leaked goroutined BEFORE test appears to have leaked :
        sync.(*Map).LoadAndDelete(0xc00031e180, {0xe07320, 0xc00009fde0})
                /usr/local/go/src/sync/map.go:272 +0x192
        sync.(*Map).Delete(...)
                /usr/local/go/src/sync/map.go:297
        crypto/tls.(*certCache).evict(...)
                /usr/local/go/src/crypto/tls/cache.go:73
        crypto/tls.(*certCache).active.func1(0x0?)
                /usr/local/go/src/crypto/tls/cache.go:65 +0x67
```

It's caused by GC instead of leaky goroutine. interestingGoroutines
should skip it.

[1]: https://github.com/golang/go/blob/8e1fdea8316d840fd07e9d6e026048e53290948b/src/crypto/tls/cache.go#L63

Signed-off-by: Wei Fu <[email protected]>
  • Loading branch information
fuweid committed Jul 5, 2024
1 parent 059371a commit ccaea7e
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions client/pkg/testutil/leak.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ func interestingGoroutines() (gs []string) {
"rcrypto/internal/boring.(*PublicKeyRSA).finalize",
"net.(*netFD).Close(",
"testing.(*T).Run",
"crypto/tls.(*certCache).evict",
}
for _, msg := range uninterestingMsgs {
if strings.Contains(stack, msg) {
Expand Down

0 comments on commit ccaea7e

Please sign in to comment.