Drifter-yh commented on code in PR #11597:
URL: https://github.com/apache/rocketmq/pull/11597#discussion_r4676337092
##########
broker/src/main/java/org/apache/rocketmq/broker/transaction/queue/TransactionalMessageServiceImpl.java:
##########
@@ -250,7 +250,7 @@ public void check(long transactionTimeout, int
transactionCheckMax,
msgExt.getUserProperty(MessageConst.PROPERTY_UNIQ_CLIENT_MESSAGE_ID_KEYIDX));
if (escapeFailCnt <
MAX_RETRY_TIMES_FOR_ESCAPE) {
escapeFailCnt++;
- Thread.sleep(100L * (2 ^ escapeFailCnt));
+
Thread.sleep(escapeRetryBackoffMillis(escapeFailCnt));
Review Comment:
Confirmed on both points. `check()` runs on the single
`TransactionalMessageCheckService` thread, so the 102 s sleep delays every
queue in that cycle, and `MAX_PROCESS_TIME_LIMIT` is only evaluated at the top
of the loop, so the sleep itself is never bounded.
I capped the backoff at `MAX_ESCAPE_RETRY_DELAY = 5000L`. Ten consecutive
failures now wait `200 + 400 + 800 + 1600 + 3200 + 5 * 5000 = 31.2 s` in total,
inside the 60 s per-queue budget; the exponential shape below the cap is
unchanged, and the test asserts `200, 400, 800, 1600, 3200, 5000, ...`.
I chose the fixed cap over bounding by the remaining budget because that
variant sleeps away whatever budget is left and then the loop-top check exits
without a retry, so it delays the cycle without buying an attempt. Pushed in
6c74345.
--
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]