You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by "haiyanghan (via GitHub)" <gi...@apache.org> on 2023/04/11 16:16:48 UTC

[GitHub] [rocketmq] haiyanghan opened a new pull request, #6575: [ISSUE #6574] fix DefaultMQProducerImpl.request sync invoke tome out

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

   **Make sure set the target branch to `develop`**
   
   ## What is the purpose of the change
   
   <!--
   If this PR fixes a GitHub issue, please add `fixes #<XXX>` or `closes #<XXX>`. Please refer to the documentation for more information:
   https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue
   -->
   
   fix #<xxx> <!-- <xxx> replace with issue id -->
   
   ## Brief changelog
   
   XX
   
   ## Verifying this change
   
   XXXX
   
   Follow this checklist to help us incorporate your contribution quickly and easily. Notice, `it would be helpful if you could finish the following 5 checklist(the last one is not necessary)before request the community to review your PR`.
   
   - [x] Make sure there is a [Github issue](https://github.com/apache/rocketmq/issues) filed for the change (usually before you start working on it). Trivial changes like typos do not require a Github issue. Your pull request should address just this issue, without pulling in other changes - one PR resolves one issue. 
   - [x] Format the pull request title like `[ISSUE #123] Fix UnknownException when host config not exist`. Each commit in the pull request should have a meaningful subject line and body.
   - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
   - [x] Write necessary unit-test(over 80% coverage) to verify your logic correction, more mock a little better when cross module dependency exist. If the new feature or significant change is committed, please remember to add integration-test in [test module](https://github.com/apache/rocketmq/tree/master/test).
   - [x] Run `mvn -B clean apache-rat:check findbugs:findbugs checkstyle:checkstyle` to make sure basic checks pass. Run `mvn clean install -DskipITs` to make sure unit-test pass. Run `mvn clean test-compile failsafe:integration-test`  to make sure integration-test pass.
   - [ ] If this contribution is large, please file an [Apache Individual Contributor License Agreement](http://www.apache.org/licenses/#clas).
   


-- 
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: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [rocketmq] codecov-commenter commented on pull request #6575: [ISSUE #6574] fix DefaultMQProducerImpl.request sync invoke tome out

Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #6575:
URL: https://github.com/apache/rocketmq/pull/6575#issuecomment-1504432706

   ## [Codecov](https://codecov.io/gh/apache/rocketmq/pull/6575?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#6575](https://codecov.io/gh/apache/rocketmq/pull/6575?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (84adab9) into [develop](https://codecov.io/gh/apache/rocketmq/commit/f44a1c3fd5e218f1038b360245479de54f83b408?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (f44a1c3) will **increase** coverage by `0.02%`.
   > The diff coverage is `8.82%`.
   
   ```diff
   @@              Coverage Diff              @@
   ##             develop    #6575      +/-   ##
   =============================================
   + Coverage      43.08%   43.10%   +0.02%     
     Complexity      8994     8994              
   =============================================
     Files           1107     1107              
     Lines          78257    78248       -9     
     Branches       10201    10202       +1     
   =============================================
   + Hits           33716    33731      +15     
   + Misses         40318    40293      -25     
   - Partials        4223     4224       +1     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/rocketmq/pull/6575?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...mq/client/impl/producer/DefaultMQProducerImpl.java](https://codecov.io/gh/apache/rocketmq/pull/6575?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y2xpZW50L3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9jbGllbnQvaW1wbC9wcm9kdWNlci9EZWZhdWx0TVFQcm9kdWNlckltcGwuamF2YQ==) | `46.47% <8.82%> (+0.51%)` | :arrow_up: |
   
   ... and [20 files with indirect coverage changes](https://codecov.io/gh/apache/rocketmq/pull/6575/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   :mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   


-- 
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: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [rocketmq] cserwen commented on a diff in pull request #6575: [ISSUE #6574] fix DefaultMQProducerImpl.request sync invoke tome out

Posted by "cserwen (via GitHub)" <gi...@apache.org>.
cserwen commented on code in PR #6575:
URL: https://github.com/apache/rocketmq/pull/6575#discussion_r1163632841


##########
client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:
##########
@@ -1462,25 +1458,23 @@ public Message request(final Message msg, final MessageQueueSelector selector, f
         final String correlationId = msg.getProperty(MessageConst.PROPERTY_CORRELATION_ID);
 
         try {
-            final RequestResponseFuture requestResponseFuture = new RequestResponseFuture(correlationId, timeout, null);
-            RequestFutureHolder.getInstance().getRequestFutureTable().put(correlationId, requestResponseFuture);
+            final RequestResponseFuture responseFuture = new RequestResponseFuture(correlationId, timeout, null);
+            RequestFutureHolder.getInstance().getRequestFutureTable().put(correlationId, responseFuture);
 
             long cost = System.currentTimeMillis() - beginTimestamp;
             this.sendSelectImpl(msg, selector, arg, CommunicationMode.ASYNC, new SendCallback() {
                 @Override
                 public void onSuccess(SendResult sendResult) {
-                    requestResponseFuture.setSendRequestOk(true);
+                    requestSuccess(correlationId, new Message(msg.getTopic(), msg.getBody()));
                 }
 
                 @Override
                 public void onException(Throwable e) {
-                    requestResponseFuture.setSendRequestOk(false);
-                    requestResponseFuture.putResponseMessage(null);
-                    requestResponseFuture.setCause(e);
+                    requestFail(correlationId, e);
                 }
             }, timeout - cost);
 
-            return waitResponse(msg, timeout, requestResponseFuture, cost);
+            return waitResponse(msg, timeout - cost, responseFuture, cost);

Review Comment:
   > time - cost More accurate, cost is pre handler time
   
   +1, maybe other  code lines alse need to be fixed.



-- 
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: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [rocketmq] haiyanghan commented on a diff in pull request #6575: [ISSUE #6574] fix DefaultMQProducerImpl.request sync invoke tome out

Posted by "haiyanghan (via GitHub)" <gi...@apache.org>.
haiyanghan commented on code in PR #6575:
URL: https://github.com/apache/rocketmq/pull/6575#discussion_r1163568847


##########
client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:
##########
@@ -1462,25 +1458,23 @@ public Message request(final Message msg, final MessageQueueSelector selector, f
         final String correlationId = msg.getProperty(MessageConst.PROPERTY_CORRELATION_ID);
 
         try {
-            final RequestResponseFuture requestResponseFuture = new RequestResponseFuture(correlationId, timeout, null);
-            RequestFutureHolder.getInstance().getRequestFutureTable().put(correlationId, requestResponseFuture);
+            final RequestResponseFuture responseFuture = new RequestResponseFuture(correlationId, timeout, null);
+            RequestFutureHolder.getInstance().getRequestFutureTable().put(correlationId, responseFuture);
 
             long cost = System.currentTimeMillis() - beginTimestamp;
             this.sendSelectImpl(msg, selector, arg, CommunicationMode.ASYNC, new SendCallback() {
                 @Override
                 public void onSuccess(SendResult sendResult) {
-                    requestResponseFuture.setSendRequestOk(true);
+                    requestSuccess(correlationId, new Message(msg.getTopic(), msg.getBody()));
                 }
 
                 @Override
                 public void onException(Throwable e) {
-                    requestResponseFuture.setSendRequestOk(false);
-                    requestResponseFuture.putResponseMessage(null);
-                    requestResponseFuture.setCause(e);
+                    requestFail(correlationId, e);
                 }
             }, timeout - cost);
 
-            return waitResponse(msg, timeout, requestResponseFuture, cost);
+            return waitResponse(msg, timeout - cost, responseFuture, cost);

Review Comment:
   time - cost More accurate, cost is  pre handler time



-- 
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: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [rocketmq] haiyanghan closed pull request #6575: [ISSUE #6574] fix DefaultMQProducerImpl.request sync invoke timeout

Posted by "haiyanghan (via GitHub)" <gi...@apache.org>.
haiyanghan closed pull request #6575: [ISSUE #6574] fix DefaultMQProducerImpl.request sync invoke timeout
URL: https://github.com/apache/rocketmq/pull/6575


-- 
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: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [rocketmq] haiyanghan commented on a diff in pull request #6575: [ISSUE #6574] fix DefaultMQProducerImpl.request sync invoke tome out

Posted by "haiyanghan (via GitHub)" <gi...@apache.org>.
haiyanghan commented on code in PR #6575:
URL: https://github.com/apache/rocketmq/pull/6575#discussion_r1163673225


##########
client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:
##########
@@ -1563,34 +1554,38 @@ public void request(final Message msg, final MessageQueue mq, final RequestCallb
         prepareSendRequest(msg, timeout);
         final String correlationId = msg.getProperty(MessageConst.PROPERTY_CORRELATION_ID);
 
-        final RequestResponseFuture requestResponseFuture = new RequestResponseFuture(correlationId, timeout, requestCallback);
-        RequestFutureHolder.getInstance().getRequestFutureTable().put(correlationId, requestResponseFuture);
+        RequestFutureHolder.getInstance().getRequestFutureTable().put(correlationId,
+                new RequestResponseFuture(correlationId, timeout, requestCallback));
 
         long cost = System.currentTimeMillis() - beginTimestamp;
         this.sendKernelImpl(msg, mq, CommunicationMode.ASYNC, new SendCallback() {
             @Override
             public void onSuccess(SendResult sendResult) {
-                requestResponseFuture.setSendRequestOk(true);
+                requestSuccess(correlationId, new Message(msg.getTopic(), msg.getBody()));

Review Comment:
   thanks,I have now made a deep copy of an object and returned it



-- 
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: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [rocketmq] cserwen commented on a diff in pull request #6575: [ISSUE #6574] fix DefaultMQProducerImpl.request sync invoke tome out

Posted by "cserwen (via GitHub)" <gi...@apache.org>.
cserwen commented on code in PR #6575:
URL: https://github.com/apache/rocketmq/pull/6575#discussion_r1163632841


##########
client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:
##########
@@ -1462,25 +1458,23 @@ public Message request(final Message msg, final MessageQueueSelector selector, f
         final String correlationId = msg.getProperty(MessageConst.PROPERTY_CORRELATION_ID);
 
         try {
-            final RequestResponseFuture requestResponseFuture = new RequestResponseFuture(correlationId, timeout, null);
-            RequestFutureHolder.getInstance().getRequestFutureTable().put(correlationId, requestResponseFuture);
+            final RequestResponseFuture responseFuture = new RequestResponseFuture(correlationId, timeout, null);
+            RequestFutureHolder.getInstance().getRequestFutureTable().put(correlationId, responseFuture);
 
             long cost = System.currentTimeMillis() - beginTimestamp;
             this.sendSelectImpl(msg, selector, arg, CommunicationMode.ASYNC, new SendCallback() {
                 @Override
                 public void onSuccess(SendResult sendResult) {
-                    requestResponseFuture.setSendRequestOk(true);
+                    requestSuccess(correlationId, new Message(msg.getTopic(), msg.getBody()));
                 }
 
                 @Override
                 public void onException(Throwable e) {
-                    requestResponseFuture.setSendRequestOk(false);
-                    requestResponseFuture.putResponseMessage(null);
-                    requestResponseFuture.setCause(e);
+                    requestFail(correlationId, e);
                 }
             }, timeout - cost);
 
-            return waitResponse(msg, timeout, requestResponseFuture, cost);
+            return waitResponse(msg, timeout - cost, responseFuture, cost);

Review Comment:
   > time - cost More accurate, cost is pre handler time
   
   +1



-- 
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: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [rocketmq] francisoliverlee commented on a diff in pull request #6575: [ISSUE #6574] fix DefaultMQProducerImpl.request sync invoke timeout

Posted by "francisoliverlee (via GitHub)" <gi...@apache.org>.
francisoliverlee commented on code in PR #6575:
URL: https://github.com/apache/rocketmq/pull/6575#discussion_r1170745369


##########
client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:
##########
@@ -1563,34 +1554,38 @@ public void request(final Message msg, final MessageQueue mq, final RequestCallb
         prepareSendRequest(msg, timeout);
         final String correlationId = msg.getProperty(MessageConst.PROPERTY_CORRELATION_ID);
 
-        final RequestResponseFuture requestResponseFuture = new RequestResponseFuture(correlationId, timeout, requestCallback);
-        RequestFutureHolder.getInstance().getRequestFutureTable().put(correlationId, requestResponseFuture);
+        RequestFutureHolder.getInstance().getRequestFutureTable().put(correlationId,
+                new RequestResponseFuture(correlationId, timeout, requestCallback));
 
         long cost = System.currentTimeMillis() - beginTimestamp;
         this.sendKernelImpl(msg, mq, CommunicationMode.ASYNC, new SendCallback() {
             @Override
             public void onSuccess(SendResult sendResult) {
-                requestResponseFuture.setSendRequestOk(true);
+                requestSuccess(correlationId, new Message(msg.getTopic(), msg.getBody()));

Review Comment:
   ok



-- 
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: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [rocketmq] haiyanghan commented on a diff in pull request #6575: [ISSUE #6574] fix DefaultMQProducerImpl.request sync invoke tome out

Posted by "haiyanghan (via GitHub)" <gi...@apache.org>.
haiyanghan commented on code in PR #6575:
URL: https://github.com/apache/rocketmq/pull/6575#discussion_r1163651126


##########
client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:
##########
@@ -1462,25 +1458,23 @@ public Message request(final Message msg, final MessageQueueSelector selector, f
         final String correlationId = msg.getProperty(MessageConst.PROPERTY_CORRELATION_ID);
 
         try {
-            final RequestResponseFuture requestResponseFuture = new RequestResponseFuture(correlationId, timeout, null);
-            RequestFutureHolder.getInstance().getRequestFutureTable().put(correlationId, requestResponseFuture);
+            final RequestResponseFuture responseFuture = new RequestResponseFuture(correlationId, timeout, null);
+            RequestFutureHolder.getInstance().getRequestFutureTable().put(correlationId, responseFuture);
 
             long cost = System.currentTimeMillis() - beginTimestamp;
             this.sendSelectImpl(msg, selector, arg, CommunicationMode.ASYNC, new SendCallback() {
                 @Override
                 public void onSuccess(SendResult sendResult) {
-                    requestResponseFuture.setSendRequestOk(true);
+                    requestSuccess(correlationId, new Message(msg.getTopic(), msg.getBody()));
                 }
 
                 @Override
                 public void onException(Throwable e) {
-                    requestResponseFuture.setSendRequestOk(false);
-                    requestResponseFuture.putResponseMessage(null);
-                    requestResponseFuture.setCause(e);
+                    requestFail(correlationId, e);
                 }
             }, timeout - cost);
 
-            return waitResponse(msg, timeout, requestResponseFuture, cost);
+            return waitResponse(msg, timeout - cost, responseFuture, cost);

Review Comment:
   enen, but the scope of current PR modification is the request method



-- 
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: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [rocketmq] francisoliverlee commented on a diff in pull request #6575: [ISSUE #6574] fix DefaultMQProducerImpl.request sync invoke tome out

Posted by "francisoliverlee (via GitHub)" <gi...@apache.org>.
francisoliverlee commented on code in PR #6575:
URL: https://github.com/apache/rocketmq/pull/6575#discussion_r1163648462


##########
client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:
##########
@@ -1563,34 +1554,38 @@ public void request(final Message msg, final MessageQueue mq, final RequestCallb
         prepareSendRequest(msg, timeout);
         final String correlationId = msg.getProperty(MessageConst.PROPERTY_CORRELATION_ID);
 
-        final RequestResponseFuture requestResponseFuture = new RequestResponseFuture(correlationId, timeout, requestCallback);
-        RequestFutureHolder.getInstance().getRequestFutureTable().put(correlationId, requestResponseFuture);
+        RequestFutureHolder.getInstance().getRequestFutureTable().put(correlationId,
+                new RequestResponseFuture(correlationId, timeout, requestCallback));
 
         long cost = System.currentTimeMillis() - beginTimestamp;
         this.sendKernelImpl(msg, mq, CommunicationMode.ASYNC, new SendCallback() {
             @Override
             public void onSuccess(SendResult sendResult) {
-                requestResponseFuture.setSendRequestOk(true);
+                requestSuccess(correlationId, new Message(msg.getTopic(), msg.getBody()));

Review Comment:
   how about message's properties ?



-- 
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: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [rocketmq] cserwen commented on a diff in pull request #6575: [ISSUE #6574] fix DefaultMQProducerImpl.request sync invoke tome out

Posted by "cserwen (via GitHub)" <gi...@apache.org>.
cserwen commented on code in PR #6575:
URL: https://github.com/apache/rocketmq/pull/6575#discussion_r1163539772


##########
client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:
##########
@@ -1462,25 +1458,23 @@ public Message request(final Message msg, final MessageQueueSelector selector, f
         final String correlationId = msg.getProperty(MessageConst.PROPERTY_CORRELATION_ID);
 
         try {
-            final RequestResponseFuture requestResponseFuture = new RequestResponseFuture(correlationId, timeout, null);
-            RequestFutureHolder.getInstance().getRequestFutureTable().put(correlationId, requestResponseFuture);
+            final RequestResponseFuture responseFuture = new RequestResponseFuture(correlationId, timeout, null);
+            RequestFutureHolder.getInstance().getRequestFutureTable().put(correlationId, responseFuture);
 
             long cost = System.currentTimeMillis() - beginTimestamp;
             this.sendSelectImpl(msg, selector, arg, CommunicationMode.ASYNC, new SendCallback() {
                 @Override
                 public void onSuccess(SendResult sendResult) {
-                    requestResponseFuture.setSendRequestOk(true);
+                    requestSuccess(correlationId, new Message(msg.getTopic(), msg.getBody()));
                 }
 
                 @Override
                 public void onException(Throwable e) {
-                    requestResponseFuture.setSendRequestOk(false);
-                    requestResponseFuture.putResponseMessage(null);
-                    requestResponseFuture.setCause(e);
+                    requestFail(correlationId, e);
                 }
             }, timeout - cost);
 
-            return waitResponse(msg, timeout, requestResponseFuture, cost);
+            return waitResponse(msg, timeout - cost, responseFuture, cost);

Review Comment:
   `timeout` or `timeout - cost` ?



-- 
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: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org