leizhiyuan opened a new issue, #1438: URL: https://github.com/apache/rocketmq-clients/issues/1438
### 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 Rust ### Runtime Platform Environment macOS 27 (arm64) ### RocketMQ Version of the Client/Server Client: Rust `rocketmq` 5.0.0, master `a3d1de8b` ### Run or Compiler Version rustc 1.98.0 ### Describe the Bug `AckMessageEntry::receipt_handle()` for `MessageView` is `self.receipt_handle.clone().unwrap()`, so it panics when the message has no receipt handle. `receipt_handle` is optional in the protocol. The proxy only sets it for popped messages (`GrpcConverter#buildSystemProperties` sets it only when the pop checkpoint property exists). A `MessageView` without a handle is therefore possible, for example the message passed to the transaction checker (`RecoverOrphanedTransactionCommand`), which is built with the same `MessageView::from_pb_message`. **Scenario.** A transaction checker logs the message, or hands it to code that calls `receipt_handle()` / `SimpleConsumer::ack` (e.g. a generic "process and ack" helper). The call panics inside the client instead of returning a value or an error. In the push consumer, `ack` / `nack` / DLQ forwarding call `receipt_handle()` on a worker task, so a message without a handle would panic there. Java never throws here. `MessageViewImpl#fromProtobuf` reads the handle with the protobuf getter (`""` when absent), and `getReceiptHandle()` returns it. An ack with an empty handle is rejected by the server with an error. ### Steps to Reproduce Unit test: build a `MessageView` with `MessageView::from_pb_message` from a `pb::Message` without `receipt_handle`, then call `AckMessageEntry::receipt_handle(&view)`. It panics at `rust/src/model/message.rs` (`called Option::unwrap() on a None value`). Not reproduced against a real server. A message without a handle comes from the transaction check, and the server I use has no transaction topic. ### What Did You Expect to See? As Java: `receipt_handle()` returns `""` and does not panic; an ack with it fails on the server. ### What Did You See Instead? A panic. ### Additional Context Found while comparing the Rust and Java SimpleConsumer implementations. --- Tracked in #1412. -- 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]
