Closed darkterrorooo closed 2 years ago
when i use kcp to send data in In multiple instances, data race is happend.
WARNING: DATA RACE Write at 0x00c000ab9800 by goroutine 150: runtime.slicecopy() /usr/local/go/src/runtime/slice.go:284 +0x0 code.nextstorage.cn/storj/common/kcp.(*UDPSession).output() /Users/apple/work/storj/storj/common/kcp/sess.go:622 +0x51a code.nextstorage.cn/storj/common/kcp.newUDPSession.func1() /Users/apple/work/storj/storj/common/kcp/sess.go:185 +0x7d
Previous write at 0x00c000ab9800 by goroutine 82: runtime.slicecopy() /usr/local/go/src/runtime/slice.go:284 +0x0 code.nextstorage.cn/storj/common/kcp.(*UDPSession).output() /Users/apple/work/storj/storj/common/kcp/sess.go:622 +0x51a code.nextstorage.cn/storj/common/kcp.newUDPSession.func1()
sess.go 622 is
bts := xmitBuf.Get().([]byte)[:len(buf)] copy(bts, buf) // line 622 msg.Buffers = [][]byte{bts}
when i use kcp to send data in In multiple instances, data race is happend.
WARNING: DATA RACE Write at 0x00c000ab9800 by goroutine 150: runtime.slicecopy() /usr/local/go/src/runtime/slice.go:284 +0x0 code.nextstorage.cn/storj/common/kcp.(*UDPSession).output() /Users/apple/work/storj/storj/common/kcp/sess.go:622 +0x51a code.nextstorage.cn/storj/common/kcp.newUDPSession.func1() /Users/apple/work/storj/storj/common/kcp/sess.go:185 +0x7d
Previous write at 0x00c000ab9800 by goroutine 82: runtime.slicecopy() /usr/local/go/src/runtime/slice.go:284 +0x0 code.nextstorage.cn/storj/common/kcp.(*UDPSession).output() /Users/apple/work/storj/storj/common/kcp/sess.go:622 +0x51a code.nextstorage.cn/storj/common/kcp.newUDPSession.func1()
sess.go 622 is
bts := xmitBuf.Get().([]byte)[:len(buf)] copy(bts, buf) // line 622 msg.Buffers = [][]byte{bts}