apache / apache/incubator-seata
seata-all 1.6.1 at模式,在断点处等待会触发两次全局回滚的bug
- Dominant language
- Java
- Stars
- 26k
- Forks
- 8.8k
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 4
Description
### Ⅰ. Issue Description
使用seata-all 1.6.1作为客户端依赖,伪代码如下:
```
public class Test{
private static String applicationId="abcd";
private static String transactionServiceGroup="my_test_tx_group";
static{
TMClient.init(applicationId, transactionServiceGroup);
RMClient.init(applicationId, transactionServiceGroup);
}
private static final TransactionalTemplate transactionalTempl = new TransactionalTemplate();
public static void test() throws Throwable{
try {
transactionalTemplate.execute(new TransactionalExecutor() {
@Override
public Object execute() throws Throwable {
throw new RuntimeException();
}
@Override
public TransactionInfo getTransactionInfo() {
TransactionInfo transactionInfo = new TransactionInfo();
transactionInfo.setTimeOut(180000);
transactionInfo.setName("default");
transactionInfo.setPropagation(Propagation.REQUIRED);
Set rollbackRules = new LinkedHashSet<>();
rollbackRules.add(new RollbackRule(Throwable.class));
transactionInfo.setRollbackRules(rollbackRules);
return transactionInfo;
}
});
}catch (Throwable e){
e.printStackTrace();
}
int i=0; //在此处添加断点,debug让程序跑到断点处停下来,会出现两次回滚 Rollback global transaction successfully
}
public static void main(String[] args) throws Throwable{
test();
}
}
```

上面图片里出现两次全局回滚,并且数据库global_table表里的相应的记录很长时间才删除!

registry.conf文件内如如下:
```
registry {
# file 、nacos 、eureka、redis、zk
type = "nacos"
nacos {
application="seata-server"
serverAddr="192.168.137.199:8848"
namespace=""
cluster="default"
group="SEATA_GROUP"
username="nacos"
password="nacos"
}
}
config {
# file、nacos 、apollo、zk
type = "file"
file {
name = "file.conf"
}
}
```
//file.conf文件内容如下
```
transport {
# tcp udt unix-domain-socket
type = "TCP"
enableRmClientBatchSendRequest = true
enableTmClientBatchSendRequest = true
#NIO NATIVE
server = "NIO"
#enable heartbeat
heartbeat = true
#thread factory for netty
threadFactory {
bossThreadPrefix = "NettyBoss"
workerThreadPrefix = "NettyServerNIOWorker"
serverExecutorThread-prefix = "NettyServerBizHandler"
shareBossWorker = false
clientSelectorThreadPrefix = "NettyClientSelector"
clientSelectorThreadSize = 1
clientWorkerThreadPrefix = "NettyClientWorkerThread"
# netty boss thread size,will not be used for UDT
bossThreadSize = 1
#auto default pin or 8
workerThreadSize = "default"
}
}
service {
#vgroup->rgroup
vgroupMapping.my_test_tx_group = "default"
#only support single node
#default.grouplist = "127.0.0.1:8091"
#degrade current not support
enableDegrade = false
#disable
disable = false
}
client {
rm {
asyncCommitBufferLimit = 10000
lock {
retryInterval = 10
retryTimes = 1
retryPolicyBranchRollbackOnConflict = true
}
reportRetryCount = 1
tableMetaCheckEnable = false
reportSuccessEnable = true
}
tm {
defaultGlobalTransactionTimeout = 180000
commitRetryCount = 1
rollbackRetryCount = 1
}
undo {
dataValidation = true
logSerialization = "jackson"
logTable = "undo_log"
}
log {
exceptionRate = 100
}
}
```
Contributor guide
Research direction
Reproduce the report with the provided TMClient.init, RMClient.init, and TransactionalTemplate example, pausing at the indicated breakpoint. Then trace the rollback flow and compare the global_table state using the supplied registry.conf and file.conf; done means the example produces one global rollback and the corresponding record is removed normally.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- distributed-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 32/100