0x-infinity opened a new issue, #1016:
URL: https://github.com/apache/incubator-seata-go/issues/1016
### 讨论详情
## Problem Description
When the seata-go client runs for approximately 2-3 minutes, it encounters a
codec decode error. The TC server (Seata 1.8.0+) sends a message with type code
111 (`TYPE_RM_DELETE_UNDOLOG`), but the seata-go client does not have a
registered codec to decode this message type.
## Error Logs
```
2025-12-06 00:49:58.019 INFO getty/listener.go:58
Open new getty session
2025-12-06 00:49:58.019 INFO getty/getty_remoting.go:82
send async message: {message.RpcMessage{ID:2, Type:0x2, Codec:0x1,
Compressor:0x0, HeadMap:map[string]string(nil),
Body:message.RegisterTMRequest{AbstractIdentifyRequest:message.AbstractIdentifyRequest{Version:"1.1.0",
ApplicationId:"applicationName", TransactionServiceGroup:"default_tx_group",
ExtraData:[]uint8(nil)}}}}
2025-12-06 00:49:58.021 INFO
client/client_on_response_processor.go:48 the rm client received
clientOnResponse msg message.RpcMessage{ID:2, Type:0x1, Codec:0x1,
Compressor:0x0, HeadMap:map[string]string{},
Body:message.RegisterTMResponse{AbstractIdentifyResponse:message.AbstractIdentifyResponse{AbstractResultMessage:message.AbstractResultMessage{ResultCode:0x0,
Msg:""}, Version:"1.8.1-SNAPSHOT", ExtraData:[]uint8(nil), Identified:true}}}
from tc server.
2025-12-06 00:49:58.120 INFO getty/getty_remoting.go:82
send async message: {message.RpcMessage{ID:1, Type:0x0, Codec:0x1,
Compressor:0x0, HeadMap:map[string]string(nil),
Body:message.RegisterRMRequest{AbstractIdentifyRequest:message.AbstractIdentifyRequest{Version:"1.5.2",
ApplicationId:"applicationName", TransactionServiceGroup:"default_tx_group",
ExtraData:[]uint8(nil)}, ResourceIds:"TestService"}}}
2025-12-06 00:49:58.122 INFO
client/client_on_response_processor.go:48 the rm client received
clientOnResponse msg message.RpcMessage{ID:1, Type:0x1, Codec:0x1,
Compressor:0x0, HeadMap:map[string]string{},
Body:message.RegisterRMResponse{AbstractIdentifyResponse:message.AbstractIdentifyResponse{AbstractResultMessage:message.AbstractResultMessage{ResultCode:0x0,
Msg:""}, Version:"1.8.1-SNAPSHOT", ExtraData:[]uint8(nil), Identified:true}}}
from tc server.
2025-12-06 00:49:58.122 INFO rm/rm_remoting.go:169
register RM success. response:
message.RegisterRMResponse{AbstractIdentifyResponse:message.AbstractIdentifyResponse{AbstractResultMessage:message.AbstractResultMessage{ResultCode:0x0,
Msg:""}, Version:"1.8.1-SNAPSHOT", ExtraData:[]uint8(nil), Identified:true}}
2025-12-06 00:49:58.122 INFO getty/getty_remoting.go:82
send async message: {message.RpcMessage{ID:3, Type:0x0, Codec:0x1,
Compressor:0x0, HeadMap:map[string]string(nil),
Body:message.GlobalBeginRequest{Timeout:60000000000,
TransactionName:"test-global-tx"}}}
2025-12-06 00:49:58.123 INFO
client/client_on_response_processor.go:48 the rm client received
clientOnResponse msg message.RpcMessage{ID:3, Type:0x1, Codec:0x1,
Compressor:0x0, HeadMap:map[string]string{},
Body:message.GlobalBeginResponse{AbstractTransactionResponse:message.AbstractTransactionResponse{AbstractResultMessage:message.AbstractResultMessage{ResultCode:0x1,
Msg:""}, TransactionErrorCode:0}, Xid:"172.23.0.2:8091:3063170758788677637",
ExtraData:[]uint8{}}} from tc server.
2025-12-06 00:49:58.123 INFO tm/global_transaction.go:66
GlobalBeginRequest success, res {{{1 } 0}
172.23.0.2:8091:3063170758788677637 []}
2025-12-06 00:49:58.123 INFO rocketmq/test.go:51
Starting global transaction
2025-12-06 00:49:58.123 INFO getty/getty_remoting.go:82
send async message: {message.RpcMessage{ID:4, Type:0x0, Codec:0x1,
Compressor:0x0, HeadMap:map[string]string(nil),
Body:message.BranchRegisterRequest{Xid:"172.23.0.2:8091:3063170758788677637",
BranchType:1, ResourceId:"TestService", LockKey:"",
ApplicationData:[]uint8{0x7b, 0x22, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x43,
0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x63, 0x74,
0x69, 0x6f, 0x6e, 0x2d, 0x73, 0x74, 0x61, 0x72, 0x74, 0x2d, 0x74, 0x69, 0x6d,
0x65, 0x22, 0x3a, 0x31, 0x37, 0x36, 0x34, 0x39, 0x35, 0x33, 0x33, 0x39, 0x38,
0x31, 0x32, 0x33, 0x2c, 0x22, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4e, 0x61,
0x6d, 0x65, 0x22, 0x3a, 0x22, 0x54, 0x65, 0x73, 0x74, 0x53, 0x65, 0x72, 0x76,
0x69, 0x63, 0x65, 0x22, 0x2c, 0x22, 0x68, 0x6f, 0x73, 0x74, 0x2d, 0x6e, 0x61,
0x6d, 0x65, 0x22, 0x3a, 0x22, 0x31, 0x39, 0x32, 0x2e, 0x31, 0x36, 0x38, 0x2e,
0x30, 0x2e, 0x31, 0x31, 0x33, 0x22, 0x2c, 0x22, 0x
73, 0x79, 0x73, 0x3a, 0x3a, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x22, 0x3a,
0x22, 0x43, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x22, 0x2c, 0x22, 0x73, 0x79, 0x73,
0x3a, 0x3a, 0x70, 0x72, 0x65, 0x70, 0x61, 0x72, 0x65, 0x22, 0x3a, 0x22, 0x50,
0x72, 0x65, 0x70, 0x61, 0x72, 0x65, 0x22, 0x2c, 0x22, 0x73, 0x79, 0x73, 0x3a,
0x3a, 0x72, 0x6f, 0x6c, 0x6c, 0x62, 0x61, 0x63, 0x6b, 0x22, 0x3a, 0x22, 0x52,
0x6f, 0x6c, 0x6c, 0x62, 0x61, 0x63, 0x6b, 0x22, 0x7d, 0x7d}}}}
2025-12-06 00:49:58.124 INFO
client/client_on_response_processor.go:48 the rm client received
clientOnResponse msg message.RpcMessage{ID:4, Type:0x1, Codec:0x1,
Compressor:0x0, HeadMap:map[string]string{},
Body:message.BranchRegisterResponse{AbstractTransactionResponse:message.AbstractTransactionResponse{AbstractResultMessage:message.AbstractResultMessage{ResultCode:0x1,
Msg:""}, TransactionErrorCode:0}, BranchId:3063170758788677638}} from tc
server.
2025-12-06 00:49:58.125 INFO rocketmq/test.go:17
TestService Prepare
2025-12-06 00:49:58.125 INFO getty/getty_remoting.go:82
send async message: {message.RpcMessage{ID:5, Type:0x0, Codec:0x1,
Compressor:0x0, HeadMap:map[string]string(nil),
Body:message.GlobalCommitRequest{AbstractGlobalEndRequest:message.AbstractGlobalEndRequest{Xid:"172.23.0.2:8091:3063170758788677637",
ExtraData:[]uint8(nil)}}}}
2025-12-06 00:49:58.125 INFO client/rm_branch_commit_processor.go:38
the rm client received rmBranchCommit msg message.RpcMessage{ID:5,
Type:0x0, Codec:0x1, Compressor:0x0, HeadMap:map[string]string{},
Body:message.BranchCommitRequest{AbstractBranchEndRequest:message.AbstractBranchEndRequest{MessageTypeAware:message.MessageTypeAware(nil),
Xid:"172.23.0.2:8091:3063170758788677637", BranchId:3063170758788677638,
BranchType:1, ResourceId:"TestService", ApplicationData:[]uint8{0x7b, 0x22,
0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74,
0x22, 0x3a, 0x7b, 0x22, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2d, 0x73, 0x74,
0x61, 0x72, 0x74, 0x2d, 0x74, 0x69, 0x6d, 0x65, 0x22, 0x3a, 0x31, 0x37, 0x36,
0x34, 0x39, 0x35, 0x33, 0x33, 0x39, 0x38, 0x31, 0x32, 0x33, 0x2c, 0x22, 0x61,
0x63, 0x74, 0x69, 0x6f, 0x6e, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x3a, 0x22, 0x54,
0x65, 0x73, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x22, 0x2c, 0x22,
0x68, 0x6f, 0x73, 0x74, 0x2d,
0x6e, 0x61, 0x6d, 0x65, 0x22, 0x3a, 0x22, 0x31, 0x39, 0x32, 0x2e, 0x31, 0x36,
0x38, 0x2e, 0x30, 0x2e, 0x31, 0x31, 0x33, 0x22, 0x2c, 0x22, 0x73, 0x79, 0x73,
0x3a, 0x3a, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x22, 0x3a, 0x22, 0x43, 0x6f,
0x6d, 0x6d, 0x69, 0x74, 0x22, 0x2c, 0x22, 0x73, 0x79, 0x73, 0x3a, 0x3a, 0x70,
0x72, 0x65, 0x70, 0x61, 0x72, 0x65, 0x22, 0x3a, 0x22, 0x50, 0x72, 0x65, 0x70,
0x61, 0x72, 0x65, 0x22, 0x2c, 0x22, 0x73, 0x79, 0x73, 0x3a, 0x3a, 0x72, 0x6f,
0x6c, 0x6c, 0x62, 0x61, 0x63, 0x6b, 0x22, 0x3a, 0x22, 0x52, 0x6f, 0x6c, 0x6c,
0x62, 0x61, 0x63, 0x6b, 0x22, 0x7d, 0x7d}}}} from tc server.
2025-12-06 00:49:58.125 INFO client/rm_branch_commit_processor.go:44
Branch committing: xid 172.23.0.2:8091:3063170758788677637, branchID
3063170758788677638, resourceID TestService, applicationData
{"actionContext":{"action-start-time":1764953398123,"actionName":"TestService","host-name":"192.168.0.113","sys::commit":"Commit","sys::prepare":"Prepare","sys::rollback":"Rollback"}}
2025-12-06 00:49:58.125 INFO rocketmq/test.go:22
TestService Commit
2025-12-06 00:49:58.125 INFO client/rm_branch_commit_processor.go:57
branch commit success: xid 172.23.0.2:8091:3063170758788677637,
branchID 3063170758788677638, resourceID TestService, applicationData
{"actionContext":{"action-start-time":1764953398123,"actionName":"TestService","host-name":"192.168.0.113","sys::commit":"Commit","sys::prepare":"Prepare","sys::rollback":"Rollback"}}
2025-12-06 00:49:58.126 INFO getty/getty_remoting.go:82
send async message: {message.RpcMessage{ID:5, Type:0x1, Codec:0x1,
Compressor:0x0, HeadMap:map[string]string(nil),
Body:message.BranchCommitResponse{AbstractBranchEndResponse:message.AbstractBranchEndResponse{AbstractTransactionResponse:message.AbstractTransactionResponse{AbstractResultMessage:message.AbstractResultMessage{ResultCode:0x1,
Msg:""}, TransactionErrorCode:0}, Xid:"172.23.0.2:8091:3063170758788677637",
BranchId:3063170758788677638, BranchStatus:5}}}}
2025-12-06 00:49:58.126 INFO client/rm_branch_commit_processor.go:90
send branch commit success: xid 172.23.0.2:8091:3063170758788677637,
branchID 3063170758788677638, resourceID TestService, applicationData [123 34
97 99 116 105 111 110 67 111 110 116 101 120 116 34 58 123 34 97 99 116 105 111
110 45 115 116 97 114 116 45 116 105 109 101 34 58 49 55 54 52 57 53 51 51 57
56 49 50 51 44 34 97 99 116 105 111 110 78 97 109 101 34 58 34 84 101 115 116
83 101 114 118 105 99 101 34 44 34 104 111 115 116 45 110 97 109 101 34 58 34
49 57 50 46 49 54 56 46 48 46 49 49 51 34 44 34 115 121 115 58 58 99 111 109
109 105 116 34 58 34 67 111 109 109 105 116 34 44 34 115 121 115 58 58 112 114
101 112 97 114 101 34 58 34 80 114 101 112 97 114 101 34 44 34 115 121 115 58
58 114 111 108 108 98 97 99 107 34 58 34 82 111 108 108 98 97 99 107 34 125 125]
2025-12-06 00:49:58.127 INFO
client/client_on_response_processor.go:48 the rm client received
clientOnResponse msg message.RpcMessage{ID:5, Type:0x1, Codec:0x1,
Compressor:0x0, HeadMap:map[string]string{},
Body:message.GlobalCommitResponse{AbstractGlobalEndResponse:message.AbstractGlobalEndResponse{AbstractTransactionResponse:message.AbstractTransactionResponse{AbstractResultMessage:message.AbstractResultMessage{ResultCode:0x1,
Msg:""}, TransactionErrorCode:0}, GlobalStatus:0x9}}} from tc server.
2025-12-06 00:50:18.127 ERROR getty/getty_client.go:102
wait resp timeout: message.RpcMessage{ID:5, Type:0x0, Codec:0x1,
Compressor:0x0, HeadMap:map[string]string(nil),
Body:message.GlobalCommitRequest{AbstractGlobalEndRequest:message.AbstractGlobalEndRequest{Xid:"172.23.0.2:8091:3063170758788677637",
ExtraData:[]uint8(nil)}}}
seata.apache.org/seata-go/pkg/remoting/getty.(*GettyRemotingClient).syncCallback
/home/finntew/Projects/incubator-seata-go/pkg/remoting/getty/getty_client.go:102
seata.apache.org/seata-go/pkg/remoting/getty.(*GettyRemoting).sendAsync
/home/finntew/Projects/incubator-seata-go/pkg/remoting/getty/getty_remoting.go:98
seata.apache.org/seata-go/pkg/remoting/getty.(*GettyRemoting).SendSync
/home/finntew/Projects/incubator-seata-go/pkg/remoting/getty/getty_remoting.go:56
seata.apache.org/seata-go/pkg/remoting/getty.(*GettyRemotingClient).SendSyncRequest
/home/finntew/Projects/incubator-seata-go/pkg/remoting/getty/getty_client.go:90
seata.apache.org/seata-go/pkg/tm.(*GlobalTransactionManager).Commit
/home/finntew/Projects/incubator-seata-go/pkg/tm/global_transaction.go:102
seata.apache.org/seata-go/pkg/tm.commitOrRollback
/home/finntew/Projects/incubator-seata-go/pkg/tm/transaction_executor.go:172
seata.apache.org/seata-go/pkg/tm.WithGlobalTx.func1
/home/finntew/Projects/incubator-seata-go/pkg/tm/transaction_executor.go:71
seata.apache.org/seata-go/pkg/tm.WithGlobalTx
/home/finntew/Projects/incubator-seata-go/pkg/tm/transaction_executor.go:93
main.main
/home/finntew/Projects/incubator-seata-go-samples/tcc/rocketmq/test.go:47
runtime.main
/usr/lib/go-1.25/src/runtime/proc.go:285
2025-12-06 00:50:18.127 ERROR getty/getty_remoting.go:59
send message: message.RpcMessage{ID:5, Type:0x0, Codec:0x1,
Compressor:0x0, HeadMap:map[string]string(nil),
Body:message.GlobalCommitRequest{AbstractGlobalEndRequest:message.AbstractGlobalEndRequest{Xid:"172.23.0.2:8091:3063170758788677637",
ExtraData:[]uint8(nil)}}}, session: session
{client_test:TCP_CLIENT:1:127.0.0.1:58776<->127.0.0.1:8091}, Read Bytes: 762,
Write Bytes: 880, Read Pkgs: 25, Write Pkgs: 26
seata.apache.org/seata-go/pkg/remoting/getty.(*GettyRemoting).SendSync
/home/finntew/Projects/incubator-seata-go/pkg/remoting/getty/getty_remoting.go:59
seata.apache.org/seata-go/pkg/remoting/getty.(*GettyRemotingClient).SendSyncRequest
/home/finntew/Projects/incubator-seata-go/pkg/remoting/getty/getty_client.go:90
seata.apache.org/seata-go/pkg/tm.(*GlobalTransactionManager).Commit
/home/finntew/Projects/incubator-seata-go/pkg/tm/global_transaction.go:102
seata.apache.org/seata-go/pkg/tm.commitOrRollback
/home/finntew/Projects/incubator-seata-go/pkg/tm/transaction_executor.go:172
seata.apache.org/seata-go/pkg/tm.WithGlobalTx.func1
/home/finntew/Projects/incubator-seata-go/pkg/tm/transaction_executor.go:71
seata.apache.org/seata-go/pkg/tm.WithGlobalTx
/home/finntew/Projects/incubator-seata-go/pkg/tm/transaction_executor.go:93
main.main
/home/finntew/Projects/incubator-seata-go-samples/tcc/rocketmq/test.go:47
runtime.main
/usr/lib/go-1.25/src/runtime/proc.go:285
2025-12-06 00:50:18.127 WARN tm/global_transaction.go:105
send global commit request failed, xid
172.23.0.2:8091:3063170758788677637, error wait response timeout, request:
message.RpcMessage{ID:5, Type:0x0, Codec:0x1, Compressor:0x0,
HeadMap:map[string]string(nil),
Body:message.GlobalCommitRequest{AbstractGlobalEndRequest:message.AbstractGlobalEndRequest{Xid:"172.23.0.2:8091:3063170758788677637",
ExtraData:[]uint8(nil)}}}
seata.apache.org/seata-go/pkg/tm.(*GlobalTransactionManager).Commit
/home/finntew/Projects/incubator-seata-go/pkg/tm/global_transaction.go:105
seata.apache.org/seata-go/pkg/tm.commitOrRollback
/home/finntew/Projects/incubator-seata-go/pkg/tm/transaction_executor.go:172
seata.apache.org/seata-go/pkg/tm.WithGlobalTx.func1
/home/finntew/Projects/incubator-seata-go/pkg/tm/transaction_executor.go:71
seata.apache.org/seata-go/pkg/tm.WithGlobalTx
/home/finntew/Projects/incubator-seata-go/pkg/tm/transaction_executor.go:93
main.main
/home/finntew/Projects/incubator-seata-go-samples/tcc/rocketmq/test.go:47
runtime.main
/usr/lib/go-1.25/src/runtime/proc.go:285
2025-12-06 00:50:18.324 INFO getty/getty_remoting.go:82
send async message: {message.RpcMessage{ID:6, Type:0x0, Codec:0x1,
Compressor:0x0, HeadMap:map[string]string(nil),
Body:message.GlobalCommitRequest{AbstractGlobalEndRequest:message.AbstractGlobalEndRequest{Xid:"172.23.0.2:8091:3063170758788677637",
ExtraData:[]uint8(nil)}}}}
2025-12-06 00:50:18.326 INFO
client/client_on_response_processor.go:48 the rm client received
clientOnResponse msg message.RpcMessage{ID:6, Type:0x1, Codec:0x1,
Compressor:0x0, HeadMap:map[string]string{},
Body:message.GlobalCommitResponse{AbstractGlobalEndResponse:message.AbstractGlobalEndResponse{AbstractTransactionResponse:message.AbstractTransactionResponse{AbstractResultMessage:message.AbstractResultMessage{ResultCode:0x1,
Msg:""}, TransactionErrorCode:0}, GlobalStatus:0xf}}} from tc server.
2025-12-06 00:50:18.326 INFO tm/global_transaction.go:115
send global commit request success, xid
172.23.0.2:8091:3063170758788677637
2025-12-06 00:50:18.326 INFO rocketmq/test.go:61
Transaction completed, waiting for error to appear...
```
## Environment
- **seata-go version**: Latest (master branch)
- **Seata TC Server version**: 1.8.0+
- **Transaction mode**: TCC or AT mode
## Minimal Reproduction Code
```go
package main
import (
"context"
"time"
"seata.apache.org/seata-go/pkg/client"
"seata.apache.org/seata-go/pkg/rm/tcc"
"seata.apache.org/seata-go/pkg/tm"
"seata.apache.org/seata-go/pkg/util/log"
)
// Simple TCC service
type TestService struct{}
func (s *TestService) Prepare(ctx context.Context, params interface{})
(bool, error) {
log.Infof("TestService Prepare")
return true, nil
}
func (s *TestService) Commit(ctx context.Context, businessCtx
*tm.BusinessActionContext) (bool, error) {
log.Infof("TestService Commit")
return true, nil
}
func (s *TestService) Rollback(ctx context.Context, businessCtx
*tm.BusinessActionContext) (bool, error) {
log.Infof("TestService Rollback")
return true, nil
}
func (s *TestService) GetActionName() string {
return "TestService"
}
func main() {
// Initialize seata client (adjust config path as needed)
client.InitPath("./conf/seatago.yml")
// Register TCC service
tccService, err := tcc.NewTCCServiceProxy(&TestService{})
if err != nil {
log.Errorf("Failed to create TCC service: %v", err)
return
}
// Execute a simple global transaction
err = tm.WithGlobalTx(context.Background(), &tm.GtxConfig{
Name: "test-global-tx",
Timeout: time.Second * 60,
}, func(ctx context.Context) error {
log.Infof("Starting global transaction")
_, err := tccService.Prepare(ctx, "test-data")
return err
})
if err != nil {
log.Errorf("Transaction failed: %v", err)
return
}
log.Infof("Transaction completed, waiting for error to appear...")
// Wait for 3 minutes to see the error
time.Sleep(3 * time.Minute)
}
```
**Configuration file** (`conf/seatago.yml`):
```yaml
seata:
application-id: test-app
tx-service-group: default_tx_group
registry:
type: file
config:
type: file
```
**Steps to reproduce:**
1. Start Seata TC Server (v1.8.0 or later)
2. Run the above code
3. Wait approximately 2-3 minutes after the transaction completes
4. Observe the error logs showing message type 111 decode failure
## Root Cause
The TC server periodically sends `UndoLogDeleteRequest` (message type 111)
to Resource Managers to clean up old undo log records. However, seata-go is
missing the necessary components to handle this message:
1. **Message Structure Field Type Issue**: `SaveDays` field has wrong type
`MessageType` instead of `int16`
- Location: `pkg/protocol/message/request_message.go:132-136`
2. **Missing Codec**: No codec implementation for
`MessageTypeRmDeleteUndolog`
- Expected location: `pkg/protocol/codec/undolog_delete_req_codec.go`
3. **Missing Processor**: No message processor to handle this request
- Expected location:
`pkg/remoting/processor/client/rm_delete_undolog_processor.go`
4. **Missing Registration**: Codec and processor not registered in
initialization
- Files: `pkg/protocol/codec/codec.go` and
`pkg/remoting/processor/client/init.go`
## Message Type 111 Definition
```java
short TYPE_RM_DELETE_UNDOLOG = 111;
```
```java
public class UndoLogDeleteRequest {
private String resourceId;
private short saveDays;
private BranchType branchType;
}
```
### 📚 相关背景
_No response_
--
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]