-
Notifications
You must be signed in to change notification settings - Fork 17.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
testing: benchmark ReportMetric panic on concurrent call #54037
Comments
Copy panic log here fatal error: concurrent map writes
fatal error: concurrent map writes
goroutine 1200 [running]:
runtime.throw({0x4ae646?, 0x0?})
/usr/local/go-faketime/src/runtime/panic.go:992 +0x71 fp=0xc0001de740 sp=0xc0001de710 pc=0x431e91
runtime.mapassign_faststr(0x4ab755?, 0x2?, {0x4ab755, 0x2})
/usr/local/go-faketime/src/runtime/map_faststr.go:212 +0x39c fp=0xc0001de7a8 sp=0xc0001de740 pc=0x4114bc
testing.(*B).ReportMetric(...)
/usr/local/go-faketime/src/testing/benchmark.go:356
main.BenchmarkReportMetrics.func1()
/tmp/sandbox1758758439/prog.go:7 +0x65 fp=0xc0001de7e0 sp=0xc0001de7a8 pc=0x48e665
runtime.goexit()
/usr/local/go-faketime/src/runtime/asm_amd64.s:1571 +0x1 fp=0xc0001de7e8 sp=0xc0001de7e0 pc=0x45cdc1
created by main.BenchmarkReportMetrics
/tmp/sandbox1758758439/prog.go:12 +0x87
goroutine 1 [chan receive]:
testing.(*B).doBench(0xc0000c4000)
/usr/local/go-faketime/src/testing/benchmark.go:285 +0x7f
testing.(*B).run(0xc0000c4000?)
/usr/local/go-faketime/src/testing/benchmark.go:279 +0x6e
testing.Benchmark(0x4b3f48)
/usr/local/go-faketime/src/testing/benchmark.go:824 +0xf5
main.main()
/tmp/sandbox1758758439/prog.go:18 +0x25
goroutine 59 [runnable]:
main.BenchmarkReportMetrics(0xc0000c4000)
/tmp/sandbox1758758439/prog.go:12 +0x87
testing.(*B).runN(0xc0000c4000, 0x2710)
/usr/local/go-faketime/src/testing/benchmark.go:193 +0x102
testing.(*B).launch(0xc0000c4000)
/usr/local/go-faketime/src/testing/benchmark.go:334 +0x1c5
created by testing.(*B).doBench
/usr/local/go-faketime/src/testing/benchmark.go:284 +0x6c
goroutine 1393 [runnable]:
main.BenchmarkReportMetrics.func1()
/tmp/sandbox1758758439/prog.go:6
created by main.BenchmarkReportMetrics
/tmp/sandbox1758758439/prog.go:12 +0x87
goroutine 1391 [runnable]:
main.BenchmarkReportMetrics.func1()
/tmp/sandbox1758758439/prog.go:6
created by main.BenchmarkReportMetrics
/tmp/sandbox1758758439/prog.go:12 +0x87
goroutine 1394 [runnable]:
main.BenchmarkReportMetrics.func1()
/tmp/sandbox1758758439/prog.go:6
created by main.BenchmarkReportMetrics
/tmp/sandbox1758758439/prog.go:12 +0x87
goroutine 1277 [running]:
goroutine running on other thread; stack unavailable
created by main.BenchmarkReportMetrics
/tmp/sandbox1758758439/prog.go:12 +0x87
goroutine 1392 [runnable]:
main.BenchmarkReportMetrics.func1()
/tmp/sandbox1758758439/prog.go:6
created by main.BenchmarkReportMetrics
/tmp/sandbox1758758439/prog.go:12 +0x87
goroutine 1396 [runnable]:
main.BenchmarkReportMetrics.func1()
/tmp/sandbox1758758439/prog.go:6
created by main.BenchmarkReportMetrics
/tmp/sandbox1758758439/prog.go:12 +0x87
goroutine 1395 [runnable]:
main.BenchmarkReportMetrics.func1()
/tmp/sandbox1758758439/prog.go:6
created by main.BenchmarkReportMetrics
/tmp/sandbox1758758439/prog.go:12 +0x87
goroutine 1389 [runnable]:
main.BenchmarkReportMetrics.func1()
/tmp/sandbox1758758439/prog.go:6
created by main.BenchmarkReportMetrics
/tmp/sandbox1758758439/prog.go:12 +0x87
goroutine 1388 [runnable]:
main.BenchmarkReportMetrics.func1()
/tmp/sandbox1758758439/prog.go:6
created by main.BenchmarkReportMetrics
/tmp/sandbox1758758439/prog.go:12 +0x87
goroutine 1387 [runnable]:
main.BenchmarkReportMetrics.func1()
/tmp/sandbox1758758439/prog.go:6
created by main.BenchmarkReportMetrics
/tmp/sandbox1758758439/prog.go:12 +0x87
goroutine 1386 [runnable]:
main.BenchmarkReportMetrics.func1()
/tmp/sandbox1758758439/prog.go:6
created by main.BenchmarkReportMetrics
/tmp/sandbox1758758439/prog.go:12 +0x87
goroutine 1390 [runnable]:
main.BenchmarkReportMetrics.func1()
/tmp/sandbox1758758439/prog.go:6
created by main.BenchmarkReportMetrics
/tmp/sandbox1758758439/prog.go:12 +0x87
goroutine 1385 [runnable]:
main.BenchmarkReportMetrics.func1()
/tmp/sandbox1758758439/prog.go:6
created by main.BenchmarkReportMetrics
/tmp/sandbox1758758439/prog.go:12 +0x87
goroutine 1277 [running]:
runtime.throw({0x4ae646?, 0x0?})
/usr/local/go-faketime/src/runtime/panic.go:992 +0x71 fp=0xc000186f40 sp=0xc000186f10 pc=0x431e91
runtime.mapassign_faststr(0x49a6e0, 0xc000012030, {0x4ab755, 0x2})
/usr/local/go-faketime/src/runtime/map_faststr.go:295 +0x38b fp=0xc000186fa8 sp=0xc000186f40 pc=0x4114ab
testing.(*B).ReportMetric(...)
/usr/local/go-faketime/src/testing/benchmark.go:356
main.BenchmarkReportMetrics.func1()
/tmp/sandbox1758758439/prog.go:7 +0x65 fp=0xc000186fe0 sp=0xc000186fa8 pc=0x48e665
runtime.goexit()
/usr/local/go-faketime/src/runtime/asm_amd64.s:1571 +0x1 fp=0xc000186fe8 sp=0xc000186fe0 pc=0x45cdc1
created by main.BenchmarkReportMetrics
/tmp/sandbox1758758439/prog.go:12 +0x87
Program exited. |
try aquire lock on benchmark extra map write |
This looks like an incorrect use of ReportMetric though |
I agree, especially given this sentence in its documentation:
Without a happens-before relationship between the calls to By convention, Go methods that mutate the state of a data-structure (as |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
example code: https://go.dev/play/p/ToeyneuJPcT
What did you expect to see?
no panic here
The text was updated successfully, but these errors were encountered: