You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@seata.apache.org by "ssshr-66 (via GitHub)" <gi...@apache.org> on 2026/09/19 09:59:39 UTC
[I] [BUG]: Fix data races in gRPC E2E tests [incubator-seata-go]
ssshr-66 opened a new issue, #1189:
URL: https://github.com/apache/incubator-seata-go/issues/1189
## **Problem symptoms:**
The Unit Test CI intermittently fails with a data race:
```text
WARNING: DATA RACE
TestE2E_SyncRequestResponseFuture
e2e_test.go:159-160
listener.go:147-148
```
It can be reproduced with:
```bash
go test -race -count=10 -timeout 60s \
-run '^TestE2E_(HeartbeatSentToServer|SyncRequestResponseFuture)$' \
./pkg/remoting/grpc
```
## **Problem localization:**
`newTestChannel` registers only two goroutines:
<img width="1400" height="172" alt="Image" src="https://github.com/user-attachments/assets/b19d3a21-a792-4ab3-892a-446c63b519f2" />
`StartReceiveLoop` calls `c.wg.Done()` when the receive loop exits, but it also starts an additional goroutine for each received message without registering it in the `WaitGroup`:
```go
func (g *grpcClientHandler) StartReceiveLoop(ctx context.Context, c *Channel) {
defer c.wg.Done()
// ...
go func() {
// Decode and process the message.
// Reads g.typeMap and g.processorMap.
}()
}
```
<img width="1340" height="1364" alt="Image" src="https://github.com/user-attachments/assets/a145d2c8-19d9-4b98-8fff-685a29323ae7" />
`Channel.close()` only waits for the registered goroutines:
```go
c.wg.Wait()
```
As a result, a message-processing goroutine from the previous test may still be reading `typeMap` and `processorMap` when the next test writes to them:
```go
handler.typeMap["GlobalBeginResponseProto"] = ...
handler.processorMap[message.MessageTypeGlobalBeginResult] = ...
```
This causes an unsynchronized read/write race between the two tests.
## **Expected outcome:**
Preserve the existing gRPC E2E behavior while ensuring that all background message-processing goroutines are properly tracked and completed during cleanup.
The following command should pass repeatedly without reporting any data race:
```bash
go test -race -count=10 -timeout 60s \
-run '^TestE2E_(HeartbeatSentToServer|TestE2E_SyncRequestResponseFuture)$' \
./pkg/remoting/grpc
```
--
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: notifications-unsubscribe@seata.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org
Re: [I] [BUG]: Fix data races in gRPC E2E tests [incubator-seata-go]
Posted by "ssshr-66 (via GitHub)" <gi...@apache.org>.
ssshr-66 commented on issue #1189:
URL: https://github.com/apache/incubator-seata-go/issues/1189#issuecomment-5748259947
@Vanillaxi
--
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: notifications-unsubscribe@seata.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org
Re: [I] [BUG]: Fix data races in gRPC E2E tests [incubator-seata-go]
Posted by "Ethan-Xingyue (via GitHub)" <gi...@apache.org>.
Ethan-Xingyue closed issue #1189: [BUG]: Fix data races in gRPC E2E tests
URL: https://github.com/apache/incubator-seata-go/issues/1189
--
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: notifications-unsubscribe@seata.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org
Re: [I] [BUG]: Fix data races in gRPC E2E tests [incubator-seata-go]
Posted by "Vanillaxi (via GitHub)" <gi...@apache.org>.
Vanillaxi commented on issue #1189:
URL: https://github.com/apache/incubator-seata-go/issues/1189#issuecomment-5748866424
plz assign to me
--
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: notifications-unsubscribe@seata.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@seata.apache.org
For additional commands, e-mail: notifications-help@seata.apache.org