Skip to content

Instantly share code, notes, and snippets.

@timvaillancourt
Last active June 11, 2024 01:29
Show Gist options
  • Save timvaillancourt/47f709fc4304c7bcd67fcaa7d9cd1f62 to your computer and use it in GitHub Desktop.
Save timvaillancourt/47f709fc4304c7bcd67fcaa7d9cd1f62 to your computer and use it in GitHub Desktop.
replicationLagCache-race.md
tvaillancourt@tvailla-ltmxctu vitess % go test -v -race -run TestThrottlerMaxLag ./go/vt/throttler/...
# vitess.io/vitess/go/vt/throttler.test
ld: warning: '/private/var/folders/zt/f3f88kb55cn7c8y2nnr7_vdc0000gq/T/go-link-2213562320/000014.o' has malformed LC_DYSYMTAB, expected 98 undefined symbols to start at index 884, found 95 undefined symbols starting at index 884
?   	vitess.io/vitess/go/vt/throttler/demo	[no test files]
?   	vitess.io/vitess/go/vt/throttler/grpcthrottlerserver	[no test files]
=== RUN   TestThrottlerMaxLag
--- PASS: TestThrottlerMaxLag (0.00s)
==================
WARNING: DATA RACE
Write at 0x00c0003dee40 by goroutine 38:
  runtime.mapassign_faststr()
      /Users/tvaillancourt/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.3.darwin-amd64/src/runtime/map_faststr.go:203 +0x0
  vitess.io/vitess/go/vt/throttler.(*replicationLagCache).add()
      /Users/tvaillancourt/github/timvaillancourt/vitess/go/vt/throttler/replication_lag_cache.go:73 +0x1b3
  vitess.io/vitess/go/vt/throttler.TestThrottlerMaxLag.func2()
      /Users/tvaillancourt/github/timvaillancourt/vitess/go/vt/throttler/throttler_test.go:437 +0xe4
  vitess.io/vitess/go/vt/throttler.TestThrottlerMaxLag.gowrap3()
      /Users/tvaillancourt/github/timvaillancourt/vitess/go/vt/throttler/throttler_test.go:453 +0x4f

Previous read at 0x00c0003dee40 by goroutine 37:
  runtime.mapiterinit()
      /Users/tvaillancourt/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.3.darwin-amd64/src/runtime/map.go:816 +0x0
  vitess.io/vitess/go/vt/throttler.(*Throttler).MaxLag()
      /Users/tvaillancourt/github/timvaillancourt/vitess/go/vt/throttler/throttler.go:236 +0x109
  vitess.io/vitess/go/vt/throttler.TestThrottlerMaxLag.func1()
      /Users/tvaillancourt/github/timvaillancourt/vitess/go/vt/throttler/throttler_test.go:424 +0xa9
  vitess.io/vitess/go/vt/throttler.TestThrottlerMaxLag.gowrap2()
      /Users/tvaillancourt/github/timvaillancourt/vitess/go/vt/throttler/throttler_test.go:428 +0x61

Goroutine 38 (running) created at:
  vitess.io/vitess/go/vt/throttler.TestThrottlerMaxLag()
      /Users/tvaillancourt/github/timvaillancourt/vitess/go/vt/throttler/throttler_test.go:430 +0x464
  testing.tRunner()
      /Users/tvaillancourt/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.3.darwin-amd64/src/testing/testing.go:1689 +0x21e
  testing.(*T).Run.gowrap1()
      /Users/tvaillancourt/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.3.darwin-amd64/src/testing/testing.go:1742 +0x44

Goroutine 37 (running) created at:
  vitess.io/vitess/go/vt/throttler.TestThrottlerMaxLag()
      /Users/tvaillancourt/github/timvaillancourt/vitess/go/vt/throttler/throttler_test.go:414 +0x2d4
  testing.tRunner()
      /Users/tvaillancourt/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.3.darwin-amd64/src/testing/testing.go:1689 +0x21e
  testing.(*T).Run.gowrap1()
      /Users/tvaillancourt/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.3.darwin-amd64/src/testing/testing.go:1742 +0x44
==================
==================
WARNING: DATA RACE
Read at 0x00c0002ad5a8 by goroutine 37:
  vitess.io/vitess/go/vt/throttler.(*replicationLagCache).latest()
      /Users/tvaillancourt/github/timvaillancourt/vitess/go/vt/throttler/replication_lag_cache.go:82 +0x23d
  vitess.io/vitess/go/vt/throttler.(*Throttler).MaxLag()
      /Users/tvaillancourt/github/timvaillancourt/vitess/go/vt/throttler/throttler.go:241 +0x1dd
  vitess.io/vitess/go/vt/throttler.TestThrottlerMaxLag.func1()
      /Users/tvaillancourt/github/timvaillancourt/vitess/go/vt/throttler/throttler_test.go:424 +0xa9
  vitess.io/vitess/go/vt/throttler.TestThrottlerMaxLag.gowrap2()
      /Users/tvaillancourt/github/timvaillancourt/vitess/go/vt/throttler/throttler_test.go:428 +0x61

Previous write at 0x00c0002ad5a8 by goroutine 38:
  vitess.io/vitess/go/vt/throttler.(*replicationLagCache).add()
      /Users/tvaillancourt/github/timvaillancourt/vitess/go/vt/throttler/replication_lag_cache.go:73 +0x1c4
  vitess.io/vitess/go/vt/throttler.TestThrottlerMaxLag.func2()
      /Users/tvaillancourt/github/timvaillancourt/vitess/go/vt/throttler/throttler_test.go:437 +0xe4
  vitess.io/vitess/go/vt/throttler.TestThrottlerMaxLag.gowrap3()
      /Users/tvaillancourt/github/timvaillancourt/vitess/go/vt/throttler/throttler_test.go:453 +0x4f

Goroutine 37 (running) created at:
  vitess.io/vitess/go/vt/throttler.TestThrottlerMaxLag()
      /Users/tvaillancourt/github/timvaillancourt/vitess/go/vt/throttler/throttler_test.go:414 +0x2d4
  testing.tRunner()
      /Users/tvaillancourt/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.3.darwin-amd64/src/testing/testing.go:1689 +0x21e
  testing.(*T).Run.gowrap1()
      /Users/tvaillancourt/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.3.darwin-amd64/src/testing/testing.go:1742 +0x44

Goroutine 38 (running) created at:
  vitess.io/vitess/go/vt/throttler.TestThrottlerMaxLag()
      /Users/tvaillancourt/github/timvaillancourt/vitess/go/vt/throttler/throttler_test.go:430 +0x464
  testing.tRunner()
      /Users/tvaillancourt/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.3.darwin-amd64/src/testing/testing.go:1689 +0x21e
  testing.(*T).Run.gowrap1()
      /Users/tvaillancourt/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.3.darwin-amd64/src/testing/testing.go:1742 +0x44
==================
=== NAME  
    testing.go:1398: race detected during execution of test
==================
WARNING: DATA RACE
Read at 0x00c00032e420 by goroutine 37:
  vitess.io/vitess/go/vt/throttler.(*replicationLagHistory).latest()
      /Users/tvaillancourt/github/timvaillancourt/vitess/go/vt/throttler/replication_lag_cache.go:201 +0x29d
  vitess.io/vitess/go/vt/throttler.(*replicationLagCache).latest()
      /Users/tvaillancourt/github/timvaillancourt/vitess/go/vt/throttler/replication_lag_cache.go:86 +0x305
  vitess.io/vitess/go/vt/throttler.(*Throttler).MaxLag()
      /Users/tvaillancourt/github/timvaillancourt/vitess/go/vt/throttler/throttler.go:241 +0x1dd
  vitess.io/vitess/go/vt/throttler.TestThrottlerMaxLag.func1()
      /Users/tvaillancourt/github/timvaillancourt/vitess/go/vt/throttler/throttler_test.go:424 +0xa9
  vitess.io/vitess/go/vt/throttler.TestThrottlerMaxLag.gowrap2()
      /Users/tvaillancourt/github/timvaillancourt/vitess/go/vt/throttler/throttler_test.go:428 +0x61

Previous write at 0x00c00032e420 by goroutine 38:
  vitess.io/vitess/go/vt/throttler.newReplicationLagHistory()
      /Users/tvaillancourt/github/timvaillancourt/vitess/go/vt/throttler/replication_lag_cache.go:190 +0x10a
  vitess.io/vitess/go/vt/throttler.(*replicationLagCache).add()
      /Users/tvaillancourt/github/timvaillancourt/vitess/go/vt/throttler/replication_lag_cache.go:72 +0xb6
  vitess.io/vitess/go/vt/throttler.TestThrottlerMaxLag.func2()
      /Users/tvaillancourt/github/timvaillancourt/vitess/go/vt/throttler/throttler_test.go:437 +0xe4
  vitess.io/vitess/go/vt/throttler.TestThrottlerMaxLag.gowrap3()
      /Users/tvaillancourt/github/timvaillancourt/vitess/go/vt/throttler/throttler_test.go:453 +0x4f

Goroutine 37 (running) created at:
  vitess.io/vitess/go/vt/throttler.TestThrottlerMaxLag()
      /Users/tvaillancourt/github/timvaillancourt/vitess/go/vt/throttler/throttler_test.go:414 +0x2d4
  testing.tRunner()
      /Users/tvaillancourt/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.3.darwin-amd64/src/testing/testing.go:1689 +0x21e
  testing.(*T).Run.gowrap1()
      /Users/tvaillancourt/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.3.darwin-amd64/src/testing/testing.go:1742 +0x44

Goroutine 38 (running) created at:
  vitess.io/vitess/go/vt/throttler.TestThrottlerMaxLag()
      /Users/tvaillancourt/github/timvaillancourt/vitess/go/vt/throttler/throttler_test.go:430 +0x464
  testing.tRunner()
      /Users/tvaillancourt/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.3.darwin-amd64/src/testing/testing.go:1689 +0x21e
  testing.(*T).Run.gowrap1()
      /Users/tvaillancourt/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.3.darwin-amd64/src/testing/testing.go:1742 +0x44
==================
FAIL
==================
WARNING: DATA RACE
Read at 0x00c00032e438 by goroutine 37:
  vitess.io/vitess/go/vt/throttler.(*replicationLagHistory).latest()
      /Users/tvaillancourt/github/timvaillancourt/vitess/go/vt/throttler/replication_lag_cache.go:201 +0x2c6
  vitess.io/vitess/go/vt/throttler.(*replicationLagCache).latest()
      /Users/tvaillancourt/github/timvaillancourt/vitess/go/vt/throttler/replication_lag_cache.go:86 +0x305
  vitess.io/vitess/go/vt/throttler.(*Throttler).MaxLag()
      /Users/tvaillancourt/github/timvaillancourt/vitess/go/vt/throttler/throttler.go:241 +0x1dd
  vitess.io/vitess/go/vt/throttler.TestThrottlerMaxLag.func1()
      /Users/tvaillancourt/github/timvaillancourt/vitess/go/vt/throttler/throttler_test.go:424 +0xa9
  vitess.io/vitess/go/vt/throttler.TestThrottlerMaxLag.gowrap2()
      /Users/tvaillancourt/github/timvaillancourt/vitess/go/vt/throttler/throttler_test.go:428 +0x61

Previous write at 0x00c00032e438 by goroutine 38:
  vitess.io/vitess/go/vt/throttler.newReplicationLagHistory()
      /Users/tvaillancourt/github/timvaillancourt/vitess/go/vt/throttler/replication_lag_cache.go:191 +0x158
  vitess.io/vitess/go/vt/throttler.(*replicationLagCache).add()
      /Users/tvaillancourt/github/timvaillancourt/vitess/go/vt/throttler/replication_lag_cache.go:72 +0xb6
  vitess.io/vitess/go/vt/throttler.TestThrottlerMaxLag.func2()
      /Users/tvaillancourt/github/timvaillancourt/vitess/go/vt/throttler/throttler_test.go:437 +0xe4
  vitess.io/vitess/go/vt/throttler.TestThrottlerMaxLag.gowrap3()
      /Users/tvaillancourt/github/timvaillancourt/vitess/go/vt/throttler/throttler_test.go:453 +0x4f

Goroutine 37 (running) created at:
  vitess.io/vitess/go/vt/throttler.TestThrottlerMaxLag()
      /Users/tvaillancourt/github/timvaillancourt/vitess/go/vt/throttler/throttler_test.go:414 +0x2d4
  testing.tRunner()
      /Users/tvaillancourt/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.3.darwin-amd64/src/testing/testing.go:1689 +0x21e
  testing.(*T).Run.gowrap1()
      /Users/tvaillancourt/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.3.darwin-amd64/src/testing/testing.go:1742 +0x44

Goroutine 38 (running) created at:
  vitess.io/vitess/go/vt/throttler.TestThrottlerMaxLag()
      /Users/tvaillancourt/github/timvaillancourt/vitess/go/vt/throttler/throttler_test.go:430 +0x464
  testing.tRunner()
      /Users/tvaillancourt/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.3.darwin-amd64/src/testing/testing.go:1689 +0x21e
  testing.(*T).Run.gowrap1()
      /Users/tvaillancourt/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.3.darwin-amd64/src/testing/testing.go:1742 +0x44
==================
==================
WARNING: DATA RACE
Read at 0x00c000700000 by goroutine 37:
  vitess.io/vitess/go/vt/throttler.(*replicationLagCache).latest()
      /Users/tvaillancourt/github/timvaillancourt/vitess/go/vt/throttler/replication_lag_cache.go:86 +0x30e
  vitess.io/vitess/go/vt/throttler.(*Throttler).MaxLag()
      /Users/tvaillancourt/github/timvaillancourt/vitess/go/vt/throttler/throttler.go:241 +0x1dd
  vitess.io/vitess/go/vt/throttler.TestThrottlerMaxLag.func1()
      /Users/tvaillancourt/github/timvaillancourt/vitess/go/vt/throttler/throttler_test.go:424 +0xa9
  vitess.io/vitess/go/vt/throttler.TestThrottlerMaxLag.gowrap2()
      /Users/tvaillancourt/github/timvaillancourt/vitess/go/vt/throttler/throttler_test.go:428 +0x61

Previous write at 0x00c000700000 by goroutine 38:
  vitess.io/vitess/go/vt/throttler.(*replicationLagHistory).add()
      /Users/tvaillancourt/github/timvaillancourt/vitess/go/vt/throttler/replication_lag_cache.go:197 +0x339
  vitess.io/vitess/go/vt/throttler.(*replicationLagCache).add()
      /Users/tvaillancourt/github/timvaillancourt/vitess/go/vt/throttler/replication_lag_cache.go:76 +0x204
  vitess.io/vitess/go/vt/throttler.TestThrottlerMaxLag.func2()
      /Users/tvaillancourt/github/timvaillancourt/vitess/go/vt/throttler/throttler_test.go:437 +0xe4
  vitess.io/vitess/go/vt/throttler.TestThrottlerMaxLag.gowrap3()
      /Users/tvaillancourt/github/timvaillancourt/vitess/go/vt/throttler/throttler_test.go:453 +0x4f

Goroutine 37 (running) created at:
  vitess.io/vitess/go/vt/throttler.TestThrottlerMaxLag()
      /Users/tvaillancourt/github/timvaillancourt/vitess/go/vt/throttler/throttler_test.go:414 +0x2d4
  testing.tRunner()
      /Users/tvaillancourt/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.3.darwin-amd64/src/testing/testing.go:1689 +0x21e
  testing.(*T).Run.gowrap1()
      /Users/tvaillancourt/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.3.darwin-amd64/src/testing/testing.go:1742 +0x44

Goroutine 38 (running) created at:
  vitess.io/vitess/go/vt/throttler.TestThrottlerMaxLag()
      /Users/tvaillancourt/github/timvaillancourt/vitess/go/vt/throttler/throttler_test.go:430 +0x464
  testing.tRunner()
      /Users/tvaillancourt/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.3.darwin-amd64/src/testing/testing.go:1689 +0x21e
  testing.(*T).Run.gowrap1()
      /Users/tvaillancourt/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.3.darwin-amd64/src/testing/testing.go:1742 +0x44
==================
==================
WARNING: DATA RACE
Read at 0x00c00057f988 by goroutine 37:
  vitess.io/vitess/go/vt/throttler.(*Throttler).MaxLag()
      /Users/tvaillancourt/github/timvaillancourt/vitess/go/vt/throttler/throttler.go:241 +0x370
FAIL	vitess.io/vitess/go/vt/throttler	1.041s
FAIL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment