Vanillaxi commented on PR #1184: URL: https://github.com/apache/incubator-seata-go/pull/1184#issuecomment-5732900123
CI 失败是因为已有的 gRPC 测试触发了 data race ,与本次修复无关。 失败用例: `TestE2E_SyncRequestResponseFuture`,错误: `WARNING: DATA RACE` 测试 A:[`TestE2E_HeartbeatSentToServer`(e2e_test.go:125)](https://github.com/apache/incubator-seata-go/blob/598074146bc4142dd33f29d5d2a2049c90ba0f6f/pkg/remoting/grpc/e2e_test.go#L125) 测试 B:[`TestE2E_SyncRequestResponseFuture`(e2e_test.go:153)](https://github.com/apache/incubator-seata-go/blob/598074146bc4142dd33f29d5d2a2049c90ba0f6f/pkg/remoting/grpc/e2e_test.go#L153) 前一个心跳测试A启动了后台消息处理 goroutine,而清理时的 WaitGroup 只等待收发循环,没有等待内部启动的消息处理 goroutine。于是后一个测试B在 [`pkg/remoting/grpc/e2e_test.go:159`](https://github.com/apache/incubator-seata-go/blob/598074146bc4142dd33f29d5d2a2049c90ba0f6f/pkg/remoting/grpc/e2e_test.go#L159) 写入共享 `typeMap`,与后台消息处理 goroutine 在 [`pkg/remoting/grpc/listener.go:147`](https://github.com/apache/incubator-seata-go/blob/598074146bc4142dd33f29d5d2a2049c90ba0f6f/pkg/remoting/grpc/listener.go#L147) 对同一 map 的未同步读取形成 data race 。 本地复现命令: ``` go test -race -count=10 -timeout 60s \ -run '^TestE2E_(HeartbeatSentToServer|SyncRequestResponseFuture)$' \ ./pkg/remoting/grpc ``` 同时检测到了 `processorMap` 也存在同类型竞争 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
