ydb-platform / ydb-go-sdk

Pure Go native and database/sql driver for YDB
https://ydb.tech
Apache License 2.0
133 stars 69 forks source link

bug: DATA RACE on xtest.grpcLoggerStream #1246

Open asmyasnikov opened 1 month ago

asmyasnikov commented 1 month ago

https://github.com/ydb-platform/ydb-go-sdk/actions/runs/9289373753/job/25563115195#step:5:869

==================
WARNING: DATA RACE
Read at 0x00c00173d8a3 by goroutine 32021:
  testing.(*common).logDepth()
      /opt/hostedtoolcache/go/1.20.14/x64/src/testing/testing.go:992 +0xc4
  testing.(*common).log()
      /opt/hostedtoolcache/go/1.20.14/x64/src/testing/testing.go:985 +0xa4
  testing.(*common).Logf()
      /opt/hostedtoolcache/go/1.20.14/x64/src/testing/testing.go:1036 +0x6a
  testing.(*T).Logf()
      <autogenerated>:1 +0x75
  github.com/ydb-platform/ydb-go-sdk/v3/internal/xtest.grpcLoggerStream.RecvMsg()
      /home/runner/work/ydb-go-sdk/ydb-go-sdk/internal/xtest/grpclogger.go:106 +0x31d
  github.com/ydb-platform/ydb-go-sdk/v3/internal/xtest.(*grpcLoggerStream).RecvMsg()
      <autogenerated>:1 +0xb5
  github.com/ydb-platform/ydb-go-sdk/v3/internal/conn.(*grpcClientStream).RecvMsg()
      /home/runner/work/ydb-go-sdk/ydb-go-sdk/internal/conn/grpc_client_stream.go:146 +0x2e1
  github.com/ydb-platform/ydb-go-genproto/Ydb_Topic_V1.(*topicServiceStreamReadClient).Recv()
      /home/runner/go/pkg/mod/github.com/ydb-platform/ydb-go-genproto@v0.0.0-20240316140903-4a47abca1cca/Ydb_Topic_V1/ydb_topic_v1_grpc.pb.go:174 +0x67
  github.com/ydb-platform/ydb-go-sdk/v3/internal/grpcwrapper/rawtopic/rawtopicreader.StreamReader.Recv()
      /home/runner/work/ydb-go-sdk/ydb-go-sdk/internal/grpcwrapper/rawtopic/rawtopicreader/rawtopicreader.go:34 +0xab
  github.com/ydb-platform/ydb-go-sdk/v3/internal/grpcwrapper/rawtopic/rawtopicreader.(*StreamReader).Recv()
      <autogenerated>:1 +0x5a
  github.com/ydb-platform/ydb-go-sdk/v3/internal/topic/topicreaderinternal.(*syncedStream).Recv()
      /home/runner/work/ydb-go-sdk/ydb-go-sdk/internal/topic/topicreaderinternal/grpc_synced_stream.go:18 +0x91
  github.com/ydb-platform/ydb-go-sdk/v3/internal/topic/topicreaderinternal.(*topicStreamReaderImpl).readMessagesLoop()
      /home/runner/work/ydb-go-sdk/ydb-go-sdk/internal/topic/topicreaderinternal/stream_reader_impl.go:499 +0x2f1
  github.com/ydb-platform/ydb-go-sdk/v3/internal/topic/topicreaderinternal.(*topicStreamReaderImpl).readMessagesLoop-fm()
      <autogenerated>:1 +0x4d
  runtime/pprof.Do()
      /opt/hostedtoolcache/go/1.20.14/x64/src/runtime/pprof/runtime.go:44 +0x122
  github.com/ydb-platform/ydb-go-sdk/v3/internal/background.(*Worker).starterLoop.func1()
      /home/runner/work/ydb-go-sdk/ydb-go-sdk/internal/background/worker.go:147 +0x334
  github.com/ydb-platform/ydb-go-sdk/v3/internal/background.(*Worker).starterLoop.func3()
      /home/runner/work/ydb-go-sdk/ydb-go-sdk/internal/background/worker.go:148 +0x66

Previous write at 0x00c00173d8a3 by goroutine 31[895](https://github.com/ydb-platform/ydb-go-sdk/actions/runs/9289373753/job/25563115195#step:5:896):
  testing.tRunner.func1()
      /opt/hostedtoolcache/go/1.20.14/x64/src/testing/testing.go:1563 +0x82d
  runtime.deferreturn()
      /opt/hostedtoolcache/go/1.20.14/x64/src/runtime/panic.go:476 +0x32
  testing.(*T).Run.func1()
      /opt/hostedtoolcache/go/1.20.14/x64/src/testing/testing.go:1629 +0x47

Goroutine 32021 (running) created at:
  github.com/ydb-platform/ydb-go-sdk/v3/internal/background.(*Worker).starterLoop()
      /home/runner/work/ydb-go-sdk/ydb-go-sdk/internal/background/worker.go:144 +0x153
  github.com/ydb-platform/ydb-go-sdk/v3/internal/background.(*Worker).init.func1.1.1()
      /home/runner/work/ydb-go-sdk/ydb-go-sdk/internal/background/worker.go:133 +0x58

Goroutine 31895 (running) created at:
  testing.(*T).Run()
      /opt/hostedtoolcache/go/1.20.14/x64/src/testing/testing.go:1629 +0x805
  testing.runTests.func1()
      /opt/hostedtoolcache/go/1.20.14/x64/src/testing/testing.go:2036 +0x8d
  testing.tRunner()
      /opt/hostedtoolcache/go/1.20.14/x64/src/testing/testing.go:1576 +0x216
  testing.runTests()
      /opt/hostedtoolcache/go/1.20.14/x64/src/testing/testing.go:2034 +0x87c
  testing.(*M).Run()
      /opt/hostedtoolcache/go/1.20.14/x64/src/testing/testing.go:1[906](https://github.com/ydb-platform/ydb-go-sdk/actions/runs/9289373753/job/25563115195#step:5:907) +0xb44
  main.main()
      _testmain.go:256 +0x2fc
==================