leizhiyuan opened a new pull request, #1455: URL: https://github.com/apache/rocketmq-clients/pull/1455
### Which Issue(s) This PR Fixes Fixes #1449 ### Brief Description Only the head of the ack retry queue was retried, every 100 ms, forever: an entry with an expired receipt handle blocked every failed ack behind it, and the queue drained its channel so it grew without bound. Aligned with Java `ProcessQueueImpl`: - Every entry is retried on its own schedule, 1 s after its last failure (`ACK_ENTRY_RETRY_DELAY`, Java `ACK_MESSAGE_FAILURE_BACKOFF_DELAY` and siblings); one tick retries every entry that is due. - Acks and nacks that fail with `INVALID_RECEIPT_HANDLE` are dropped, on the first attempt and on retries (Java "forgive to retry"). DLQ forwards keep retrying on any error, like Java. - The retry queue holds at most `MAX_PENDING_ACK_ENTRIES` (1024) entries; the task stops taking from the channel (also 1024) when full, so the worker waits on the next failed entry and stops receiving, instead of the queue growing. Java bounds this through the process queue cache. - A worker blocked on a full queue no longer blocks the actor shutdown: the retry task also stops on a child of the actor's shutdown token. ### How Did You Test This Change? **Unit tests**, all fail on `master`: - `test_ack_retry_is_not_blocked_by_an_invalid_receipt_handle`: an invalid handle followed by 20 failed acks; the 20 must be retried, the invalid one sent once (master: the 20 are never retried). - `test_ack_with_invalid_receipt_handle_is_not_retried` (master: retried 14 times in 1.3 s). - `test_ack_retry_queue_is_bounded_and_shutdown_unblocks_senders`: 3,072 failing acks; at most 2,049 accepted, and cancelling the actor's token unblocks the sender (master: all 3,072 accepted). **End-to-end** (mock proxy over real gRPC, 400 messages, the first ack of each fails once, 4 invalid receipt handles, 3 runs): | | `master` | this PR | |---|---|---| | valid acks done | 140–176 of 396 after 15 s, then stuck | **396 after 1.5 s** | | ack attempts on the 4 invalid handles in 15 s | 377–413 | **4** | ``` $ cargo test # lib: 153 passed, 0 failed (master: 150) $ cargo clippy --all-features -- -D warnings # clean $ cargo fmt --check # clean $ RUSTDOCFLAGS='--cfg docsrs' cargo doc --no-deps --all-features # ok $ cargo build --examples --all-features # ok $ cargo +1.74.0 check --all-features --tests --examples # ok (MSRV) ``` --- Part of #1445 (overview, end-to-end benchmark and merge order). -- 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]
