Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
diag: thread-safety step5 - race in speedtest (#11138)
- attempt to upgrade speedtest - to fix race: showwin/speedtest-go#109 (comment) It didn't help. Created: showwin/speedtest-go#223 I see: ``` ================== WARNING: DATA RACE Write at 0x00c2167c2088 by goroutine 70275: github.com/showwin/speedtest-go/speedtest.(*TestDirection).Start.func1.1() /home/ubuntu/go/pkg/mod/github.com/showwin/[email protected]/speedtest/data_manager.go:203 +0x84 sync.(*Once).doSlow() /usr/local/go/src/sync/once.go:74 +0xf0 sync.(*Once).Do() /usr/local/go/src/sync/once.go:65 +0x44 github.com/showwin/speedtest-go/speedtest.(*TestDirection).Start.func1() /home/ubuntu/go/pkg/mod/github.com/showwin/[email protected]/speedtest/data_manager.go:200 +0xb1 Previous read at 0x00c2167c2088 by goroutine 69927: github.com/showwin/speedtest-go/speedtest.(*DataChunk).Read() /home/ubuntu/go/pkg/mod/github.com/showwin/[email protected]/speedtest/data_manager.go:452 +0x64 io.(*nopCloser).Read() <autogenerated>:1 +0x6c io.(*LimitedReader).Read() /usr/local/go/src/io/io.go:479 +0xc5 io.copyBuffer() /usr/local/go/src/io/io.go:429 +0x29a io.Copy() /usr/local/go/src/io/io.go:388 +0x6f net.genericReadFrom() /usr/local/go/src/net/net.go:689 +0x12 net.(*TCPConn).readFrom() /usr/local/go/src/net/tcpsock_posix.go:54 +0xc9 net.(*TCPConn).ReadFrom() /usr/local/go/src/net/tcpsock.go:130 +0x64 io.copyBuffer() /usr/local/go/src/io/io.go:415 +0x22e io.Copy() /usr/local/go/src/io/io.go:388 +0x95 net/http.persistConnWriter.ReadFrom() /usr/local/go/src/net/http/transport.go:1824 +0x12 bufio.(*Writer).ReadFrom() /usr/local/go/src/bufio/bufio.go:794 +0x2b0 io.copyBuffer() /usr/local/go/src/io/io.go:415 +0x22e io.CopyBuffer() /usr/local/go/src/io/io.go:402 +0x8f net/http.(*transferWriter).doBodyCopy() /usr/local/go/src/net/http/transfer.go:416 +0x144 net/http.(*transferWriter).writeBody() /usr/local/go/src/net/http/transfer.go:371 +0x75c net/http.(*Request).write() /usr/local/go/src/net/http/request.go:755 +0x1413 net/http.(*persistConn).writeLoop() /usr/local/go/src/net/http/transport.go:2447 +0x379 net/http.(*Transport).dialConn.gowrap3() /usr/local/go/src/net/http/transport.go:1800 +0x33 Goroutine 70275 (running) created at: github.com/showwin/speedtest-go/speedtest.(*TestDirection).rateCapture.func1() /home/ubuntu/go/pkg/mod/github.com/showwin/[email protected]/speedtest/data_manager.go:267 +0x3ef github.com/showwin/speedtest-go/speedtest.(*TestDirection).rateCapture.gowrap1() /home/ubuntu/go/pkg/mod/github.com/showwin/[email protected]/speedtest/data_manager.go:279 +0x41 Goroutine 69927 (running) created at: net/http.(*Transport).dialConn() /usr/local/go/src/net/http/transport.go:1800 +0x27fe net/http.(*Transport).dialConnFor() /usr/local/go/src/net/http/transport.go:1485 +0x124 net/http.(*Transport).queueForDial.gowrap1() /usr/local/go/src/net/http/transport.go:1449 +0x44 ================== ================== WARNING: DATA RACE Write at 0x00c2167c2088 by goroutine 63832: github.com/showwin/speedtest-go/speedtest.(*TestDirection).Start.func1.1() /home/ubuntu/go/pkg/mod/github.com/showwin/[email protected]/speedtest/data_manager.go:203 +0x84 sync.(*Once).doSlow() /usr/local/go/src/sync/once.go:74 +0xf0 sync.(*Once).Do() /usr/local/go/src/sync/once.go:65 +0x44 github.com/showwin/speedtest-go/speedtest.(*TestDirection).Start.func1() /home/ubuntu/go/pkg/mod/github.com/showwin/[email protected]/speedtest/data_manager.go:200 +0xb1 Previous read at 0x00c2167c2088 by goroutine 57836: github.com/showwin/speedtest-go/speedtest.(*DataChunk).DownloadHandler() /home/ubuntu/go/pkg/mod/github.com/showwin/[email protected]/speedtest/data_manager.go:408 +0x3ee github.com/showwin/speedtest-go/speedtest.downloadRequest() /home/ubuntu/go/pkg/mod/github.com/showwin/[email protected]/speedtest/request.go:183 +0x624 github.com/showwin/speedtest-go/speedtest.(*Server).downloadTestContext.func1() /home/ubuntu/go/pkg/mod/github.com/showwin/[email protected]/speedtest/request.go:119 +0x85 github.com/showwin/speedtest-go/speedtest.(*TestDirection).Start.func2() /home/ubuntu/go/pkg/mod/github.com/showwin/[email protected]/speedtest/data_manager.go:218 +0xca Goroutine 63832 (running) created at: time.goFunc() /usr/local/go/src/time/sleep.go:177 +0x44 Goroutine 57836 (running) created at: github.com/showwin/speedtest-go/speedtest.(*TestDirection).Start() /home/ubuntu/go/pkg/mod/github.com/showwin/[email protected]/speedtest/data_manager.go:212 +0x70a github.com/showwin/speedtest-go/speedtest.(*Server).downloadTestContext() /home/ubuntu/go/pkg/mod/github.com/showwin/[email protected]/speedtest/request.go:122 +0x2e8 github.com/showwin/speedtest-go/speedtest.(*Server).DownloadTestContext() /home/ubuntu/go/pkg/mod/github.com/showwin/[email protected]/speedtest/request.go:109 +0x1ee github.com/ledgerwatch/erigon-lib/diagnostics.(*DiagnosticClient).runSpeedTest() /home/ubuntu/erigon/erigon-lib/diagnostics/speedtest.go:66 +0x1d2 github.com/ledgerwatch/erigon-lib/diagnostics.(*DiagnosticClient).setupSpeedtestDiagnostics.func1() /home/ubuntu/erigon/erigon-lib/diagnostics/speedtest.go:35 +0xf2 ================== ================== WARNING: DATA RACE Write at 0x00c2167c2068 by goroutine 63836: github.com/showwin/speedtest-go/speedtest.(*DataChunk).UploadHandler() /home/ubuntu/go/pkg/mod/github.com/showwin/[email protected]/speedtest/data_manager.go:440 +0x247 github.com/showwin/speedtest-go/speedtest.uploadRequest() /home/ubuntu/go/pkg/mod/github.com/showwin/[email protected]/speedtest/request.go:188 +0x113 github.com/showwin/speedtest-go/speedtest.(*Server).uploadTestContext.func1() /home/ubuntu/go/pkg/mod/github.com/showwin/[email protected]/speedtest/request.go:150 +0x85 github.com/showwin/speedtest-go/speedtest.(*TestDirection).Start.func2() /home/ubuntu/go/pkg/mod/github.com/showwin/[email protected]/speedtest/data_manager.go:218 +0xca Previous read at 0x00c2167c2068 by goroutine 63840: github.com/showwin/speedtest-go/speedtest.(*DataChunk).UploadHandler() /home/ubuntu/go/pkg/mod/github.com/showwin/[email protected]/speedtest/data_manager.go:438 +0x179 github.com/showwin/speedtest-go/speedtest.uploadRequest() /home/ubuntu/go/pkg/mod/github.com/showwin/[email protected]/speedtest/request.go:188 +0x113 github.com/showwin/speedtest-go/speedtest.(*Server).uploadTestContext.func1() /home/ubuntu/go/pkg/mod/github.com/showwin/[email protected]/speedtest/request.go:150 +0x85 github.com/showwin/speedtest-go/speedtest.(*TestDirection).Start.func2() /home/ubuntu/go/pkg/mod/github.com/showwin/[email protected]/speedtest/data_manager.go:218 +0xca Goroutine 63836 (running) created at: github.com/showwin/speedtest-go/speedtest.(*TestDirection).Start() /home/ubuntu/go/pkg/mod/github.com/showwin/[email protected]/speedtest/data_manager.go:212 +0x70a github.com/showwin/speedtest-go/speedtest.(*Server).uploadTestContext() /home/ubuntu/go/pkg/mod/github.com/showwin/[email protected]/speedtest/request.go:153 +0x2e8 github.com/showwin/speedtest-go/speedtest.(*Server).UploadTestContext() /home/ubuntu/go/pkg/mod/github.com/showwin/[email protected]/speedtest/request.go:140 +0x25c github.com/ledgerwatch/erigon-lib/diagnostics.(*DiagnosticClient).runSpeedTest() /home/ubuntu/erigon/erigon-lib/diagnostics/speedtest.go:71 +0x240 github.com/ledgerwatch/erigon-lib/diagnostics.(*DiagnosticClient).setupSpeedtestDiagnostics.func1() /home/ubuntu/erigon/erigon-lib/diagnostics/speedtest.go:35 +0xf2 Goroutine 63840 (running) created at: github.com/showwin/speedtest-go/speedtest.(*TestDirection).Start() /home/ubuntu/go/pkg/mod/github.com/showwin/[email protected]/speedtest/data_manager.go:212 +0x70a github.com/showwin/speedtest-go/speedtest.(*Server).uploadTestContext() /home/ubuntu/go/pkg/mod/github.com/showwin/[email protected]/speedtest/request.go:153 +0x2e8 github.com/showwin/speedtest-go/speedtest.(*Server).UploadTestContext() /home/ubuntu/go/pkg/mod/github.com/showwin/[email protected]/speedtest/request.go:140 +0x25c github.com/ledgerwatch/erigon-lib/diagnostics.(*DiagnosticClient).runSpeedTest() /home/ubuntu/erigon/erigon-lib/diagnostics/speedtest.go:71 +0x240 github.com/ledgerwatch/erigon-lib/diagnostics.(*DiagnosticClient).setupSpeedtestDiagnostics.func1() /home/ubuntu/erigon/erigon-lib/diagnostics/speedtest.go:35 +0xf2 ================== ================== WARNING: DATA RACE Write at 0x00c2167c2068 by goroutine 63840: github.com/showwin/speedtest-go/speedtest.(*DataChunk).UploadHandler() /home/ubuntu/go/pkg/mod/github.com/showwin/[email protected]/speedtest/data_manager.go:440 +0x247 github.com/showwin/speedtest-go/speedtest.uploadRequest() /home/ubuntu/go/pkg/mod/github.com/showwin/[email protected]/speedtest/request.go:188 +0x113 github.com/showwin/speedtest-go/speedtest.(*Server).uploadTestContext.func1() /home/ubuntu/go/pkg/mod/github.com/showwin/[email protected]/speedtest/request.go:150 +0x85 github.com/showwin/speedtest-go/speedtest.(*TestDirection).Start.func2() /home/ubuntu/go/pkg/mod/github.com/showwin/[email protected]/speedtest/data_manager.go:218 +0xca Previous write at 0x00c2167c2068 by goroutine 63835: github.com/showwin/speedtest-go/speedtest.(*DataChunk).UploadHandler() /home/ubuntu/go/pkg/mod/github.com/showwin/[email protected]/speedtest/data_manager.go:440 +0x247 github.com/showwin/speedtest-go/speedtest.uploadRequest() /home/ubuntu/go/pkg/mod/github.com/showwin/[email protected]/speedtest/request.go:188 +0x113 github.com/showwin/speedtest-go/speedtest.(*Server).uploadTestContext.func1() /home/ubuntu/go/pkg/mod/github.com/showwin/[email protected]/speedtest/request.go:150 +0x85 github.com/showwin/speedtest-go/speedtest.(*TestDirection).Start.func2() /home/ubuntu/go/pkg/mod/github.com/showwin/[email protected]/speedtest/data_manager.go:218 +0xca Goroutine 63840 (running) created at: github.com/showwin/speedtest-go/speedtest.(*TestDirection).Start() /home/ubuntu/go/pkg/mod/github.com/showwin/[email protected]/speedtest/data_manager.go:212 +0x70a github.com/showwin/speedtest-go/speedtest.(*Server).uploadTestContext() /home/ubuntu/go/pkg/mod/github.com/showwin/[email protected]/speedtest/request.go:153 +0x2e8 github.com/showwin/speedtest-go/speedtest.(*Server).UploadTestContext() /home/ubuntu/go/pkg/mod/github.com/showwin/[email protected]/speedtest/request.go:140 +0x25c github.com/ledgerwatch/erigon-lib/diagnostics.(*DiagnosticClient).runSpeedTest() /home/ubuntu/erigon/erigon-lib/diagnostics/speedtest.go:71 +0x240 github.com/ledgerwatch/erigon-lib/diagnostics.(*DiagnosticClient).setupSpeedtestDiagnostics.func1() /home/ubuntu/erigon/erigon-lib/diagnostics/speedtest.go:35 +0xf2 Goroutine 63835 (running) created at: github.com/showwin/speedtest-go/speedtest.(*TestDirection).Start() /home/ubuntu/go/pkg/mod/github.com/showwin/[email protected]/speedtest/data_manager.go:212 +0x70a github.com/showwin/speedtest-go/speedtest.(*Server).uploadTestContext() /home/ubuntu/go/pkg/mod/github.com/showwin/[email protected]/speedtest/request.go:153 +0x2e8 github.com/showwin/speedtest-go/speedtest.(*Server).UploadTestContext() /home/ubuntu/go/pkg/mod/github.com/showwin/[email protected]/speedtest/request.go:140 +0x25c github.com/ledgerwatch/erigon-lib/diagnostics.(*DiagnosticClient).runSpeedTest() /home/ubuntu/erigon/erigon-lib/diagnostics/speedtest.go:71 +0x240 github.com/ledgerwatch/erigon-lib/diagnostics.(*DiagnosticClient).setupSpeedtestDiagnostics.func1() /home/ubuntu/erigon/erigon-lib/diagnostics/speedtest.go:35 +0xf2 ================== ================== WARNING: DATA RACE Read at 0x00c2167c2100 by goroutine 63833: github.com/showwin/speedtest-go/speedtest.(*TestDirection).rateCapture.func1() /home/ubuntu/go/pkg/mod/github.com/showwin/[email protected]/speedtest/data_manager.go:258 +0x1c6 github.com/showwin/speedtest-go/speedtest.(*TestDirection).rateCapture.gowrap1() /home/ubuntu/go/pkg/mod/github.com/showwin/[email protected]/speedtest/data_manager.go:279 +0x41 Previous write at 0x00c2167c2100 by goroutine 63888: sync/atomic.AddInt64() /usr/local/go/src/runtime/race_amd64.s:289 +0xb sync/atomic.AddInt64() <autogenerated>:1 +0x15 io.(*nopCloser).Read() <autogenerated>:1 +0x6c io.(*LimitedReader).Read() /usr/local/go/src/io/io.go:479 +0xc5 io.copyBuffer() /usr/local/go/src/io/io.go:429 +0x29a io.Copy() /usr/local/go/src/io/io.go:388 +0x6f net.genericReadFrom() /usr/local/go/src/net/net.go:689 +0x12 net.(*TCPConn).readFrom() /usr/local/go/src/net/tcpsock_posix.go:54 +0xc9 net.(*TCPConn).ReadFrom() /usr/local/go/src/net/tcpsock.go:130 +0x64 io.copyBuffer() /usr/local/go/src/io/io.go:415 +0x22e io.Copy() /usr/local/go/src/io/io.go:388 +0x95 net/http.persistConnWriter.ReadFrom() /usr/local/go/src/net/http/transport.go:1824 +0x12 bufio.(*Writer).ReadFrom() /usr/local/go/src/bufio/bufio.go:794 +0x2b0 io.copyBuffer() /usr/local/go/src/io/io.go:415 +0x22e io.CopyBuffer() /usr/local/go/src/io/io.go:402 +0x8f net/http.(*transferWriter).doBodyCopy() /usr/local/go/src/net/http/transfer.go:416 +0x144 net/http.(*transferWriter).writeBody() /usr/local/go/src/net/http/transfer.go:371 +0x75c net/http.(*Request).write() /usr/local/go/src/net/http/request.go:755 +0x1413 net/http.(*persistConn).writeLoop() /usr/local/go/src/net/http/transport.go:2447 +0x379 net/http.(*Transport).dialConn.gowrap3() /usr/local/go/src/net/http/transport.go:1800 +0x33 Goroutine 63833 (running) created at: github.com/showwin/speedtest-go/speedtest.(*TestDirection).rateCapture() /home/ubuntu/go/pkg/mod/github.com/showwin/[email protected]/speedtest/data_manager.go:253 +0x464 github.com/showwin/speedtest-go/speedtest.(*TestDirection).Start() /home/ubuntu/go/pkg/mod/github.com/showwin/[email protected]/speedtest/data_manager.go:195 +0x4a4 github.com/showwin/speedtest-go/speedtest.(*Server).uploadTestContext() /home/ubuntu/go/pkg/mod/github.com/showwin/[email protected]/speedtest/request.go:153 +0x2e8 github.com/showwin/speedtest-go/speedtest.(*Server).UploadTestContext() /home/ubuntu/go/pkg/mod/github.com/showwin/[email protected]/speedtest/request.go:140 +0x25c github.com/ledgerwatch/erigon-lib/diagnostics.(*DiagnosticClient).runSpeedTest() /home/ubuntu/erigon/erigon-lib/diagnostics/speedtest.go:71 +0x240 github.com/ledgerwatch/erigon-lib/diagnostics.(*DiagnosticClient).setupSpeedtestDiagnostics.func1() /home/ubuntu/erigon/erigon-lib/diagnostics/speedtest.go:35 +0xf2 Goroutine 63888 (running) created at: net/http.(*Transport).dialConn() /usr/local/go/src/net/http/transport.go:1800 +0x27fe net/http.(*Transport).dialConnFor() /usr/local/go/src/net/http/transport.go:1485 +0x124 net/http.(*Transport).queueForDial.gowrap1() /usr/local/go/src/net/http/transport.go:1449 +0x44 ================== ``` - also i don't understand why do we need cached client object #10259
- Loading branch information