[Bug] A malformed receipt handle is reported as INTERNAL_SERVER_ERROR, so official clients retry the ack forever
维护者通常 1 天内回复
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 停滞
- 技术栈
- grpc, java
调研方向
Read ReceiptHandle.decode, ResponseBuilder#buildStatus(Throwable), and the receipt handle call sites in AckMessageActivity, ChangeInvisibleDurationActivity, and ForwardMessageToDeadLetterQueue. Trace how parse errors become response statuses, then check the single and batch ack behavior. Done means malformed handles report INVALID_RECEIPT_HANDLE consistently and valid entries in a mixed batch can still be acknowledged.
由索引模型根据 Issue 内容生成。
描述
Before Creating the Bug Report
- I found a bug, not just asking a question, which should be created in GitHub Discussions.
- I have searched the GitHub Issues and GitHub Discussions of this repository and believe that this is not a duplicate.
- I have confirmed that this bug belongs to the current repository, not other repositories of RocketMQ.
Runtime platform environment
OS: any (proxy module, gRPC v2 consumer path)
RocketMQ version
branch: develop
Git commit id: 9ea2ccdc2b41445aee5e177e14e501d606f5a1ed (2026-10-08)
JDK Version
Compiler: Temurin 1.8.0_504 (target 1.8, same as CI)
Description
A receipt handle that cannot be parsed is reported as INTERNAL_SERVER_ERROR, not as INVALID_RECEIPT_HANDLE.
ReceiptHandle.decode throws IllegalArgumentException for a handle that does not parse (and NumberFormatException, also
an IllegalArgumentException, for non-numeric fields). In the gRPC v2 consumer path that exception reaches
ResponseBuilder#buildStatus(Throwable), which only maps ProxyException / GrpcProxyException, topic-not-found,
MQBrokerException, MQClientException, RemotingTimeoutException and the auth exceptions:
log.error("internal server error", t);
return buildStatus(Code.INTERNAL_SERVER_ERROR, ExceptionUtils.getErrorDetailMessage(t));
For an expired handle the code already reports the right thing — AbstractProcessor#validateReceiptHandle throws
ProxyException(ProxyExceptionCode.INVALID_RECEIPT_HANDLE) and the mapping table turns that into
Code.INVALID_RECEIPT_HANDLE — but a malformed handle takes the parse-error path instead. Concretely:
AckMessageActivity#processAckMessagecatches the parse failure and completes the entry with
INTERNAL_SERVER_ERROR;AckMessageActivity#ackMessageInBatchdecodes every entry before calling the processor, so one unparseable handle fails
the whole batch request;ChangeInvisibleDurationActivityandForwardMessageToDeadLetterQueuedecode the same way.
This matters to the official clients: rocketmq-clients ProcessQueueImpl#ackMessage gives up on a message only for
INVALID_RECEIPT_HANDLE ("forgive to retry") and otherwise calls ackMessageLater(...), retrying the ack every second
indefinitely. So a malformed handle produces an endless ack retry loop plus internal server error logs and server-error
alerts instead of a single, actionable client error — and in the batch case it also fails the valid entries of the same
request.
service.proto documents the expectation for AckMessage: "If the given receipt_handle is illegal or out of date, returns
INVALID_ARGUMENT", and definition.proto defines the dedicated INVALID_RECEIPT_HANDLE = 40013.
Steps to Reproduce
- Run a proxy and send
AckMessagewithreceipt_handle = "not-a-receipt-handle"(one entry, or mixed with a valid entry
in a batch). - The entry/request status is
INTERNAL_SERVER_ERRORinstead ofINVALID_RECEIPT_HANDLE; withenableBatchAck=truethe
whole request fails and the valid entries are not acknowledged either.
Expected behavior
An unparseable receipt handle is reported as INVALID_RECEIPT_HANDLE, exactly like an expired one, so clients drop the
message instead of retrying forever.
Actual behavior
INTERNAL_SERVER_ERROR (and, in the batch path, a request-scoped failure that hides the graded reason).
Additional context
Fix: decode receipt handles through a helper that turns the parse failure into
ProxyException(ProxyExceptionCode.INVALID_RECEIPT_HANDLE, …), and use it at the ack (single + batch),
change-invisible-time and forward-to-DLQ call sites.
- 主要语言
- Java
- 星标
- 22.7k
- 派生
- 12k
- 平均合并
- 4 天 20 小时
- 30 天内合并 PR
- 11
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
apache/rocketmq 的其他 Issue
-
[Bug] RemotingHelper.connect swaps the socket send and receive buffer configuration可能已有人在做 @amalsaidov 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
CompressionType.of fails under the Turkish locale可能已有人在做 @sharanggupta 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 83/100
维护者通常 1 天内回复
-
[rocketmq-client-python] TransactionMQProducer allocates an unused producer during initialization未关闭
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
[Bug] notifyMasterOnline aborts the long-polling wake-up with a NullPointerException when an arrival drains a bucket first可能已有人在做 @iloveeyjafjalla 于 29 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 82/100
apache/rocketmq#11441 · 1 条评论 ·
维护者通常 1 天内回复
-
[Enhancement] FilterFactory duplicate-registration and unregister semantics lack tests可能已有人在做 @chennaji9 于 34 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 84/100
apache/rocketmq#11340 · 2 条评论 ·
维护者通常 1 天内回复
相似的 Issue
-
bug emitter:client:csharp
难度 2/5 1-3 小时 新手友好度 84/100
microsoft/typespec#12572 · 1 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
-
GCC 15.2: -Wcast-qual warning - cast discards const qualifier from pointer target type (H5trace.c)未关闭
难度 2/5 1-3 小时 新手友好度 73/100
维护者通常 1 天内回复
-
needs-area-label
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 2 天内回复
-
area/ai area/backend component/zeebe kind/task
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
spAnser/reacharound#38 ·