Skip to content

Commit ec11ecc

Browse files
marefrgopherbot
authored andcommitted
trace: fix data race in RenderEvents
This commit updates the RenderEvents function by moving the read lock for event families so that it happens before checking the length of event families and by that fixing a data race problem. Fixes golang/go#76402 Change-Id: Id02ebaa25cec8ef631aaf928ba084b0692e84583 Reviewed-on: https://go-review.googlesource.com/c/net/+/723160 Auto-Submit: Sean Liao <[email protected]> Reviewed-by: Sean Liao <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Auto-Submit: Damien Neil <[email protected]> Reviewed-by: Damien Neil <[email protected]> Reviewed-by: Nicholas Husin <[email protected]> Reviewed-by: Nicholas Husin <[email protected]>
1 parent bff14c5 commit ec11ecc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

trace/events.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ func RenderEvents(w http.ResponseWriter, req *http.Request, sensitive bool) {
5858
Buckets: buckets,
5959
}
6060

61-
data.Families = make([]string, 0, len(families))
6261
famMu.RLock()
62+
data.Families = make([]string, 0, len(families))
6363
for name := range families {
6464
data.Families = append(data.Families, name)
6565
}

0 commit comments

Comments
 (0)