apache / rocketmq

Apache RocketMQ is a cloud native messaging and streaming platform, making it simple to build event-driven applications.
https://rocketmq.apache.org/
Apache License 2.0
20.88k stars 11.55k forks source link

[Bug] Transaction producer didn't receive CheckTransacationState request of pending message #8316

Open redlsz opened 1 month ago

redlsz commented 1 month ago

Before Creating the Bug Report

Runtime platform environment

unreleated

RocketMQ version

5.x

JDK Version

1.8

Describe the Bug

image

In transaction message scenario, the first time execution result was UNKNOW. We expected to receive broker's check request later, but did not.

Steps to Reproduce

  1. Startup server in proxy cluster mode
  2. Startup a remoting TransactionProducer
  3. Sleep 5 seconds before sending one transaction message, and return UNKNOW in TransactionListener#executeLocalTransaction
  4. Keep TransactionProducer running and don't send more messages
  5. Observe whether TransactionListener#checkLocalTransaction will be called

What Did You Expect to See?

TransactionListener#checkLocalTransaction will be called

What Did You See Instead?

TransactionListener#checkLocalTransaction has not been called

Additional Context

No response

redlsz commented 1 month ago
image

Transaction log indicates that the broker cannot find producer channel when trying to call client CheckTransactionState.

image

In this case, the producer send message before its first heartbeat, which causes offline misjudgement when scanning at ClusterTransactionService#scanProducerHeartBeat. Eventually, this producer will not be registered to brokers.