This is an automated email from the ASF dual-hosted git repository.
jinrongtong pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/rocketmq.git
The following commit(s) were added to refs/heads/develop by this push:
new 3dcba4b5cd [ISSUE #6792] Fix the bug that send method blocked on
log.warn for a long time (#6793)
3dcba4b5cd is described below
commit 3dcba4b5cd13556def95327372e5c1e50449a166
Author: DL1231 <[email protected]>
AuthorDate: Tue May 23 11:36:44 2023 +0800
[ISSUE #6792] Fix the bug that send method blocked on log.warn for a long
time (#6793)
---
.../impl/producer/DefaultMQProducerImpl.java | 22 +++++++++++++++-------
1 file changed, 15 insertions(+), 7 deletions(-)
diff --git
a/client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java
b/client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java
index 565e86cf75..4eb0e69247 100644
---
a/client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java
+++
b/client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java
@@ -651,15 +651,19 @@ public class DefaultMQProducerImpl implements
MQProducerInner {
} catch (RemotingException | MQClientException e) {
endTimestamp = System.currentTimeMillis();
this.updateFaultItem(mq.getBrokerName(), endTimestamp
- beginTimestampPrev, true);
- log.warn("sendKernelImpl exception, resend at once,
InvokeID: {}, RT: {}ms, Broker: {}", invokeID, endTimestamp -
beginTimestampPrev, mq, e);
- log.warn(msg.toString());
+ log.warn("sendKernelImpl exception, resend at once,
InvokeID: %s, RT: %sms, Broker: %s", invokeID, endTimestamp -
beginTimestampPrev, mq, e);
+ if (log.isDebugEnabled()) {
+ log.debug(msg.toString());
+ }
exception = e;
continue;
} catch (MQBrokerException e) {
endTimestamp = System.currentTimeMillis();
this.updateFaultItem(mq.getBrokerName(), endTimestamp
- beginTimestampPrev, true);
- log.warn("sendKernelImpl exception, resend at once,
InvokeID: {}, RT: {}ms, Broker: {}", invokeID, endTimestamp -
beginTimestampPrev, mq, e);
- log.warn(msg.toString());
+ log.warn("sendKernelImpl exception, resend at once,
InvokeID: %s, RT: %sms, Broker: %s", invokeID, endTimestamp -
beginTimestampPrev, mq, e);
+ if (log.isDebugEnabled()) {
+ log.debug(msg.toString());
+ }
exception = e;
if
(this.defaultMQProducer.getRetryResponseCodes().contains(e.getResponseCode())) {
continue;
@@ -673,8 +677,10 @@ public class DefaultMQProducerImpl implements
MQProducerInner {
} catch (InterruptedException e) {
endTimestamp = System.currentTimeMillis();
this.updateFaultItem(mq.getBrokerName(), endTimestamp
- beginTimestampPrev, false);
- log.warn("sendKernelImpl exception, throw exception,
InvokeID: {}, RT: {}ms, Broker: {}", invokeID, endTimestamp -
beginTimestampPrev, mq, e);
- log.warn(msg.toString());
+ log.warn("sendKernelImpl exception, throw exception,
InvokeID: %s, RT: %sms, Broker: %s", invokeID, endTimestamp -
beginTimestampPrev, mq, e);
+ if (log.isDebugEnabled()) {
+ log.debug(msg.toString());
+ }
throw e;
}
} else {
@@ -947,7 +953,9 @@ public class DefaultMQProducerImpl implements
MQProducerInner {
}
} catch (IOException e) {
log.error("tryToCompressMessage exception", e);
- log.warn(msg.toString());
+ if (log.isDebugEnabled()) {
+ log.debug(msg.toString());
+ }
}
}
}