apache / apache/rocketmq-clients
[Bug] No unack messages were received again when using SimpleConsumer
- Dominant language
- Java
- Stars
- 505
- Forks
- 313
- Avg merge
- 11h 28m
- Merged PRs (30d)
- 6
Description
### Before Creating the Bug Report
- [x] I found a bug, not just asking a question, which should be created in [GitHub Discussions](https://github.com/apache/rocketmq-clients/discussions).
- [x] I have searched the [GitHub Issues](https://github.com/apache/rocketmq-clients/issues) and [GitHub Discussions](https://github.com/apache/rocketmq-clients/discussions) of this repository and believe that this is not a duplicate.
- [x] I have confirmed that this bug belongs to the current repository, not other repositories of RocketMQ.
### Programming Language of the Client
Python
### Runtime Platform Environment
- SDK: rocketmq-python-client==5.1.1
- Python: 3.12
- RocketMQ Server: 5.5.0 (use docker)
- OS: debian 12
### RocketMQ Version of the Client/Server
server is apache/rocketmq:5.5.0
client is rocketmq-python-client==5.1.1
### Run or Compiler Version
_No response_
### Describe the Bug
No unack messages were received again when using SimpleConsumer
The code is:
``` python
def rocketmq_consumer_process(debug: bool, no_color: bool, log_extra: bool | Default): # pyright: ignore[reportUnusedParameter]
"""RocketMQ消费者进程"""
# setup_logging(debug, no_color, log_extra)
if getattr(app, "configure_logging", False) and (app.debug or debug): # pyright: ignore[reportUnknownArgumentType]
logger.setLevel(logging.DEBUG)
logger.debug(f"RocketMQ消费者进程启动,PID: {os.getpid()}")
global consumer, _running
_running = True
endpoints = config_reader.get_conf_item("rocket_mq.endpoints")
topic = config_reader.get_conf_item("rocket_mq.doc_convert.topic")
group = config_reader.get_conf_item("rocket_mq.doc_convert.group")
config = ClientConfiguration(endpoints, Credentials())
consumer = SimpleConsumer(config, group, {topic: FilterExpression()}, await_duration=15)
consumer.startup()
# consumer.subscribe(topic)
try:
while _running:
start = time.monotonic()
logger.debug(">>> 开始 receive")
messages = consumer.receive(max_message_num=1, invisible_duration=10)
elapsed = time.monotonic() - start
logger.warning(
"<<< receive 返回,耗时 %.3f 秒,消息数量=%d",
elapsed,
len(messages),
)
if messages:
msg = messages[0] # pyright: ignore[reportIndexIssue]
# 在这里处理消息...
logger.warning(
"收到消息: message_id=%s body=%s",
msg.message_id,
msg.body.decode(),
)
else:
logger.debug("没有消息=====")
except KeyboardInterrupt:
if consumer:
consumer.shutdown()
consumer = None
```
The log is :
```
Rocke 2026-08-25 20:43:46 +0800 WARNING: <<< receive 返回,耗时 14.850 秒,消息数量=1
Rocke 2026-08-25 20:43:46 +0800 WARNING: 收到消息: message_id=AC1A000800012FF4ACD07E53E367000A body={"_id":"6a8c2345cd03da5830ec13f1","originalRequest":{"fileUrl":"https://untrue-providence.net/","fileMimeType":"audio/3gpp2","fileName":"________.m2a","fileType":"audio"},"status":0,"taskType":"sensitive_check","createTime":"2026-08-24 18:56:05","updateTime":"2026-08-24 18:56:05"}
Rocke 2026-08-25 20:43:46 +0800 DEBUG: >>> 开始 receive
Rocke 2026-08-25 20:44:01 +0800 WARNING: <<< receive 返回,耗时 14.969 秒,消息数量=0
Rocke 2026-08-25 20:44:01 +0800 DEBUG: 没有消息=====
Rocke 2026-08-25 20:44:01 +0800 DEBUG: >>> 开始 receive
Rocke 2026-08-25 20:44:16 +0800 WARNING: <<< receive 返回,耗时 14.971 秒,消息数量=0
Rocke 2026-08-25 20:44:16 +0800 DEBUG: 没有消息=====
Rocke 2026-08-25 20:44:16 +0800 DEBUG: >>> 开始 receive
Rocke 2026-08-25 20:44:31 +0800 WARNING: <<< receive 返回,耗时 14.980 秒,消息数量=0
Rocke 2026-08-25 20:44:31 +0800 DEBUG: 没有消息=====
Rocke 2026-08-25 20:44:31 +0800 DEBUG: >>> 开始 receive
Rocke 2026-08-25 20:44:46 +0800 WARNING: <<< receive 返回,耗时 14.973 秒,消息数量=0
Rocke 2026-08-25 20:44:46 +0800 DEBUG: 没有消息=====
Rocke 2026-08-25 20:44:46 +0800 DEBUG: >>> 开始 receive
Rocke 2026-08-25 20:45:01 +0800 WARNING: <<< receive 返回,耗时 14.959 秒,消息数量=0
Rocke 2026-08-25 20:45:01 +0800 DEBUG: 没有消息=====
Rocke 2026-08-25 20:45:01 +0800 DEBUG: >>> 开始 receive
Rocke 2026-08-25 20:45:16 +0800 WARNING: <<< receive 返回,耗时 14.976 秒,消息数量=0
Rocke 2026-08-25 20:45:16 +0800 DEBUG: 没有消息=====
Rocke 2026-08-25 20:45:16 +0800 DEBUG: >>> 开始 receive
Rocke 2026-08-25 20:45:31 +0800 WARNING: <<< receive 返回,耗时 14.974 秒,消息数量=0
Rocke 2026-08-25 20:45:31 +0800 DEBUG: 没有消息=====
Rocke 2026-08-25 20:45:31 +0800 DEBUG: >>> 开始 receive
Rocke 2026-08-25 20:45:46 +0800 WARNING: <<< receive 返回,耗时 14.973 秒,消息数量=0
Rocke 2026-08-25 20:45:46 +0800 DEBUG: 没有消息=====
Rocke 2026-08-25 20:45:46 +0800 DEBUG: >>> 开始 receive
Rocke 2026-08-25 20:46:01 +0800 WARNING: <<< receive 返回,耗时 14.973 秒,消息数量=0
Rocke 2026-08-25 20:46:01 +0800 DEBUG: 没有消息=====
Rocke 2026-08-25 20:46:01 +0800 DEBUG: >>> 开始 receive
Rocke 2026-08-25 20:46:16 +0800 WARNING: <<< receive 返回,耗时 14.974 秒,消息数量=0
Rocke 2026-08-25 20:46:16 +0800 DEBUG: 没有消息=====
Rocke 2026-08-25 20:46:16 +0800 DEBUG: >>> 开始 receive
Rocke 2026-08-25 20:46:31 +0800 WARNING: <<< receive 返回,耗时 14.955 秒,消息数量=0
Rocke 2026-08-25 20:46:31 +0800 DEBUG: 没有消息=====
Rocke 2026-08-25 20:46:31 +0800 DEBUG: >>> 开始 receive
Rocke 2026-08-25 20:46:46 +0800 WARNING: <<< receive 返回,耗时 14.977 秒,消息数量=0
Rocke 2026-08-25 20:46:46 +0800 DEBUG: 没有消息=====
Rocke 2026-08-25 20:46:46 +0800 DEBUG: >>> 开始 receive
Rocke 2026-08-25 20:47:01 +0800 WARNING: <<< receive 返回,耗时 14.980 秒,消息数量=0
Rocke 2026-08-25 20:47:01 +0800 DEBUG: 没有消息=====
Rocke 2026-08-25 20:47:01 +0800 DEBUG: >>> 开始 receive
Rocke 2026-08-25 20:47:16 +0800 WARNING: <<< receive 返回,耗时 14.975 秒,消息数量=0
Rocke 2026-08-25 20:47:16 +0800 DEBUG: 没有消息=====
Rocke 2026-08-25 20:47:16 +0800 DEBUG: >>> 开始 receive
Rocke 2026-08-25 20:47:31 +0800 WARNING: <<< receive 返回,耗时 14.973 秒,消息数量=0
Rocke 2026-08-25 20:47:31 +0800 DEBUG: 没有消息=====
Rocke 2026-08-25 20:47:31 +0800 DEBUG: >>> 开始 receive
Rocke 2026-08-25 20:47:46 +0800 WARNING: <<< receive 返回,耗时 14.971 秒,消息数量=0
Rocke 2026-08-25 20:47:46 +0800 DEBUG: 没有消息=====
Rocke 2026-08-25 20:47:46 +0800 DEBUG: >>> 开始 receive
Rocke 2026-08-25 20:48:01 +0800 WARNING: <<< receive 返回,耗时 14.973 秒,消息数量=0
Rocke 2026-08-25 20:48:01 +0800 DEBUG: 没有消息=====
Rocke 2026-08-25 20:48:01 +0800 DEBUG: >>> 开始 receive
Rocke 2026-08-25 20:48:16 +0800 WARNING: <<< receive 返回,耗时 14.976 秒,消息数量=0
Rocke 2026-08-25 20:48:16 +0800 DEBUG: 没有消息=====
Rocke 2026-08-25 20:48:16 +0800 DEBUG: >>> 开始 receive
Rocke 2026-08-25 20:48:31 +0800 WARNING: <<< receive 返回,耗时 14.972 秒,消息数量=0
Rocke 2026-08-25 20:48:31 +0800 DEBUG: 没有消息=====
Rocke 2026-08-25 20:48:31 +0800 DEBUG: >>> 开始 receive
Rocke 2026-08-25 20:48:46 +0800 WARNING: <<< receive 返回,耗时 14.959 秒,消息数量=0
Rocke 2026-08-25 20:48:46 +0800 DEBUG: 没有消息=====
Rocke 2026-08-25 20:48:46 +0800 DEBUG: >>> 开始 receive
Rocke 2026-08-25 20:49:01 +0800 WARNING: <<< receive 返回,耗时 14.977 秒,消息数量=0
Rocke 2026-08-25 20:49:01 +0800 DEBUG: 没有消息=====
Rocke 2026-08-25 20:49:01 +0800 DEBUG: >>> 开始 receive
Rocke 2026-08-25 20:49:16 +0800 WARNING: <<< receive 返回,耗时 14.976 秒,消息数量=0
Rocke 2026-08-25 20:49:16 +0800 DEBUG: 没有消息=====
Rocke 2026-08-25 20:49:16 +0800 DEBUG: >>> 开始 receive
Rocke 2026-08-25 20:49:31 +0800 WARNING: <<< receive 返回,耗时 14.961 秒,消息数量=0
Rocke 2026-08-25 20:49:31 +0800 DEBUG: 没有消息=====
Rocke 2026-08-25 20:49:31 +0800 DEBUG: >>> 开始 receive
Rocke 2026-08-25 20:49:46 +0800 WARNING: <<< receive 返回,耗时 14.971 秒,消息数量=0
Rocke 2026-08-25 20:49:46 +0800 DEBUG: 没有消息=====
Rocke 2026-08-25 20:49:46 +0800 DEBUG: >>> 开始 receive
Rocke 2026-08-25 20:50:01 +0800 WARNING: <<< receive 返回,耗时 14.958 秒,消息数量=0
Rocke 2026-08-25 20:50:01 +0800 DEBUG: 没有消息=====
Rocke 2026-08-25 20:50:01 +0800 DEBUG: >>> 开始 receive
Rocke 2026-08-25 20:50:16 +0800 WARNING: <<< receive 返回,耗时 14.972 秒,消息数量=0
Rocke 2026-08-25 20:50:16 +0800 DEBUG: 没有消息=====
Rocke 2026-08-25 20:50:16 +0800 DEBUG: >>> 开始 receive
Rocke 2026-08-25 20:50:31 +0800 WARNING: <<< receive 返回,耗时 14.974 秒,消息数量=0
Rocke 2026-08-25 20:50:31 +0800 DEBUG: 没有消息=====
Rocke 2026-08-25 20:50:31 +0800 DEBUG: >>> 开始 receive
Rocke 2026-08-25 20:50:46 +0800 WARNING: <<< receive 返回,耗时 14.960 秒,消息数量=0
Rocke 2026-08-25 20:50:46 +0800 DEBUG: 没有消息=====
Rocke 2026-08-25 20:50:46 +0800 DEBUG: >>> 开始 receive
Rocke 2026-08-25 20:51:01 +0800 WARNING: <<< receive 返回,耗时 14.958 秒,消息数量=0
Rocke 2026-08-25 20:51:01 +0800 DEBUG: 没有消息=====
Rocke 2026-08-25 20:51:01 +0800 DEBUG: >>> 开始 receive
Rocke 2026-08-25 20:51:16 +0800 WARNING: <<< receive 返回,耗时 14.976 秒,消息数量=0
Rocke 2026-08-25 20:51:16 +0800 DEBUG: 没有消息=====
Rocke 2026-08-25 20:51:16 +0800 DEBUG: >>> 开始 receive
Rocke 2026-08-25 20:51:31 +0800 WARNING: <<< receive 返回,耗时 14.976 秒,消息数量=0
Rocke 2026-08-25 20:51:31 +0800 DEBUG: 没有消息=====
Rocke 2026-08-25 20:51:31 +0800 DEBUG: >>> 开始 receive
Rocke 2026-08-25 20:51:45 +0800 WARNING: <<< receive 返回,耗时 14.975 秒,消息数量=0
Rocke 2026-08-25 20:51:45 +0800 DEBUG: 没有消息=====
Rocke 2026-08-25 20:51:45 +0800 DEBUG: >>> 开始 receive
Rocke 2026-08-25 20:52:00 +0800 WARNING: <<< receive 返回,耗时 14.977 秒,消息数量=0
Rocke 2026-08-25 20:52:00 +0800 DEBUG: 没有消息=====
Rocke 2026-08-25 20:52:00 +0800 DEBUG: >>> 开始 receive
Rocke 2026-08-25 20:52:15 +0800 WARNING: <<< receive 返回,耗时 14.957 秒,消息数量=0
Rocke 2026-08-25 20:52:15 +0800 DEBUG: 没有消息=====
Rocke 2026-08-25 20:52:15 +0800 DEBUG: >>> 开始 receive
Rocke 2026-08-25 20:52:30 +0800 WARNING: <<< receive 返回,耗时 14.959 秒,消息数量=0
Rocke 2026-08-25 20:52:30 +0800 DEBUG: 没有消息=====
Rocke 2026-08-25 20:52:30 +0800 DEBUG: >>> 开始 receive
Rocke 2026-08-25 20:52:45 +0800 WARNING: <<< receive 返回,耗时 14.976 秒,消息数量=0
Rocke 2026-08-25 20:52:45 +0800 DEBUG: 没有消息=====
```
### Steps to Reproduce
run the code and watch the log
### What Did You Expect to See?
Received unack message after 10 seconds
### What Did You See Instead?
The log show that no messages were received
### Additional Context
_No response_
Contributor guide
No contributing guide indexed for this repository
Research direction
Start at the Python SimpleConsumer entry points shown in the report, especially startup(), receive(), await_duration, and invisible_duration. Reproduce the supplied example against RocketMQ 5.5.0, trace why later receive calls return no unacknowledged message, and confirm the expected message is returned after 10 seconds.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- distributed-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100