iloveeyjafjalla opened a new pull request, #11376:
URL: https://github.com/apache/rocketmq/pull/11376

   ### Which Issue(s) This PR Fixes
   
   - Fixes #11375
   
   ### Brief Description
   
   A receipt handle that cannot be parsed was reported as 
`INTERNAL_SERVER_ERROR`. `ReceiptHandle.decode` throws
   `IllegalArgumentException`, and `ResponseBuilder#buildStatus(Throwable)` 
maps anything it does not recognize (including that
   exception) to an internal error — while an **expired** handle already 
reports `INVALID_RECEIPT_HANDLE` through
   `ProxyException(ProxyExceptionCode.INVALID_RECEIPT_HANDLE)` from 
`AbstractProcessor#validateReceiptHandle`. The two kinds of
   bad handle therefore disagreed, and the disagreement is visible to users: 
`rocketmq-clients` `ProcessQueueImpl#ackMessage`
   gives up on a message only for `INVALID_RECEIPT_HANDLE` and otherwise 
retries the ack every second indefinitely, so a
   malformed handle caused an endless retry loop plus `internal server error` 
logs. In the batch ack path the parse failure
   additionally failed the whole request, valid entries included.
   
   The change adds `ProxyUtils#decodeReceiptHandle`, which reports the parse 
failure as
   `ProxyException(ProxyExceptionCode.INVALID_RECEIPT_HANDLE, …)`, and uses it 
at the four decode sites: the single and batch
   ack paths, `ChangeInvisibleDuration`, and `ForwardMessageToDeadLetterQueue`.
   
   ### How Did You Test This Change?
   
   New tests in `AckMessageActivityTest`:
   
   - `testAckMessageWithMalformedReceiptHandle` (single path): ack with 
`receipt_handle = "not-a-receipt-handle"` → the status
     must be `INVALID_RECEIPT_HANDLE`.
   - `testBatchAckMessageWithMalformedReceiptHandle` (batch path): the 
request-scoped failure must carry the graded
     `ProxyExceptionCode.INVALID_RECEIPT_HANDLE` instead of the raw parse error 
(the gRPC layer turns a `ProxyException` into
     that status).
   
   Results on Temurin JDK 8 (same JDK as CI), base `9ea2ccdc2` plus this patch:
   
   - before the fix: single path `expected:<INVALID_RECEIPT_HANDLE> but 
was:<INTERNAL_SERVER_ERROR>`; batch path
     `expected a graded proxy failure, got java.lang.IllegalArgumentException: 
Parse failed, dataList size 1`
   - after the fix: `AckMessageActivityTest`, 
`ChangeInvisibleDurationActivityTest`, `ForwardMessageToDLQActivityTest`,
     `ReceiveMessageActivityTest` — 20 tests, 0 failures
   - `mvn -B -ntp -pl proxy package` with checkstyle + spotbugs enabled: `BUILD 
SUCCESS`, spotbugs `BugInstance size is 0`
   
   This change was prepared with AI assistance (analysis, patch and test 
drafting); the diff and every result above were
   reproduced locally by running the module's tests against the base commit and 
the patched tree.
   


-- 
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]

Reply via email to