uber / tchannel-go

Go implementation of a multiplexing and framing protocol for RPC calls
http://uber.github.io/tchannel/
MIT License
490 stars 84 forks source link

Data race detected via TestPeerSelectionAfterClosed #906

Open cinchurge opened 1 year ago

cinchurge commented 1 year ago

Stack trace:

WARNING: DATA RACE
Write at 0x00c0016df068 by goroutine 4775:
  github.com/uber/tchannel-go_test.waitTillNConnections.func1()
      /home/runner/work/tchannel-go/tchannel-go/src/github.com/uber/tchannel-go/peer_test.go:745 +0x78
  github.com/uber/tchannel-go.(*Peer).callOnUpdateComplete()
      /home/runner/work/tchannel-go/tchannel-go/src/github.com/uber/tchannel-go/peer.go:612 +0x66
  github.com/uber/tchannel-go.(*Channel).updatePeer()
      /home/runner/work/tchannel-go/tchannel-go/src/github.com/uber/tchannel-go/channel.go:687 +0x84
  github.com/uber/tchannel-go.(*Channel).exchangeUpdated()
      /home/runner/work/tchannel-go/tchannel-go/src/github.com/uber/tchannel-go/channel.go:680 +0xd5
  github.com/uber/tchannel-go.(*Channel).exchangeUpdated-fm()
      <autogenerated>:1 +0x3d
  github.com/uber/tchannel-go.(*Connection).callOnExchangeChange()
      /home/runner/work/tchannel-go/tchannel-go/src/github.com/uber/tchannel-go/connection.go:443 +0x51
  github.com/uber/tchannel-go.(*Connection).checkExchanges()
      /home/runner/work/tchannel-go/tchannel-go/src/github.com/uber/tchannel-go/connection.go:843 +0x33
  github.com/uber/tchannel-go.(*Connection).checkExchanges-fm()
      <autogenerated>:1 +0x33
  github.com/uber/tchannel-go.(*messageExchangeSet).removeExchange()
      /home/runner/work/tchannel-go/tchannel-go/src/github.com/uber/tchannel-go/mex.go:403 +0x292
  github.com/uber/tchannel-go.(*messageExchange).shutdown()
      /home/runner/work/tchannel-go/tchannel-go/src/github.com/uber/tchannel-go/mex.go:266 +0xd6
  github.com/uber/tchannel-go.(*InboundCallResponse).doneSending()
      /home/runner/work/tchannel-go/tchannel-go/src/github.com/uber/tchannel-go/inbound.go:451 +0x575
  github.com/uber/tchannel-go.(*fragmentingWriter).Close()
      /home/runner/work/tchannel-go/tchannel-go/src/github.com/uber/tchannel-go/fragmenting_writer.go:275 +0x2b1
  github.com/uber/tchannel-go.ArgWriteHelper.write()
      /home/runner/work/tchannel-go/tchannel-go/src/github.com/uber/tchannel-go/arguments.go:133 +0x93
  github.com/uber/tchannel-go.ArgWriteHelper.Write()
      /home/runner/work/tchannel-go/tchannel-go/src/github.com/uber/tchannel-go/arguments.go:138 +0x353
  github.com/uber/tchannel-go/raw.WriteResponse()
      /home/runner/work/tchannel-go/tchannel-go/src/github.com/uber/tchannel-go/raw/handler.go:83 +0x251
  github.com/uber/tchannel-go_test.(*peerSelectionTest).setupClient.Wrap.func1()
      /home/runner/work/tchannel-go/tchannel-go/src/github.com/uber/tchannel-go/raw/handler.go:102 +0xf5
  github.com/uber/tchannel-go.HandlerFunc.Handle()
      /home/runner/work/tchannel-go/tchannel-go/src/github.com/uber/tchannel-go/handlers.go:49 +0x47
  github.com/uber/tchannel-go.(*handlerMap).Handle()
      /home/runner/work/tchannel-go/tchannel-go/src/github.com/uber/tchannel-go/handlers.go:123 +0x343
  github.com/uber/tchannel-go.channelHandler.Handle()
      /home/runner/work/tchannel-go/tchannel-go/src/github.com/uber/tchannel-go/handlers.go:131 +0x9d
  github.com/uber/tchannel-go.(*Connection).dispatchInbound()
      /home/runner/work/tchannel-go/tchannel-go/src/github.com/uber/tchannel-go/inbound.go:223 +0x890
  github.com/uber/tchannel-go.(*Connection).handleCallReq.func3()
      /home/runner/work/tchannel-go/tchannel-go/src/github.com/uber/tchannel-go/inbound.go:131 +0x65

Previous read at 0x00c0016df068 by goroutine 4776:
  github.com/uber/tchannel-go_test.waitTillNConnections.func1()
      /home/runner/work/tchannel-go/tchannel-go/src/github.com/uber/tchannel-go/peer_test.go:745 +0xa6
  github.com/uber/tchannel-go.(*Peer).callOnUpdateComplete()
      /home/runner/work/tchannel-go/tchannel-go/src/github.com/uber/tchannel-go/peer.go:612 +0x66
  github.com/uber/tchannel-go.(*Channel).updatePeer()
      /home/runner/work/tchannel-go/tchannel-go/src/github.com/uber/tchannel-go/channel.go:687 +0x84
  github.com/uber/tchannel-go.(*Channel).exchangeUpdated()
      /home/runner/work/tchannel-go/tchannel-go/src/github.com/uber/tchannel-go/channel.go:680 +0xd5
  github.com/uber/tchannel-go.(*Channel).exchangeUpdated-fm()
      <autogenerated>:1 +0x3d
  github.com/uber/tchannel-go.(*Connection).callOnExchangeChange()
      /home/runner/work/tchannel-go/tchannel-go/src/github.com/uber/tchannel-go/connection.go:443 +0x51
  github.com/uber/tchannel-go.(*Connection).checkExchanges()
      /home/runner/work/tchannel-go/tchannel-go/src/github.com/uber/tchannel-go/connection.go:843 +0x33
  github.com/uber/tchannel-go.(*Connection).checkExchanges-fm()
      <autogenerated>:1 +0x33
  github.com/uber/tchannel-go.(*messageExchangeSet).expireExchange()
      /home/runner/work/tchannel-go/tchannel-go/src/github.com/uber/tchannel-go/mex.go:428 +0x36b
  github.com/uber/tchannel-go.(*messageExchange).inboundExpired()
      /home/runner/work/tchannel-go/tchannel-go/src/github.com/uber/tchannel-go/mex.go:275 +0x324
  github.com/uber/tchannel-go.(*Connection).dispatchInbound.func1()
      /home/runner/work/tchannel-go/tchannel-go/src/github.com/uber/tchannel-go/inbound.go:210 +0x2c9