You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by "FantasyChen-DH (via GitHub)" <gi...@apache.org> on 2023/03/14 03:15:05 UTC

[GitHub] [rocketmq] FantasyChen-DH opened a new pull request, #6337: fix(remoting): fix forgetting doAfterRPCHooks in Async

FantasyChen-DH opened a new pull request, #6337:
URL: https://github.com/apache/rocketmq/pull/6337

   **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] FantasyChen-DH commented on a diff in pull request #6337: fix(remoting): fix forgetting doAfterRPCHooks in Async

Posted by "FantasyChen-DH (via GitHub)" <gi...@apache.org>.
FantasyChen-DH commented on code in PR #6337:
URL: https://github.com/apache/rocketmq/pull/6337#discussion_r1151387778


##########
remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingAbstract.java:
##########
@@ -355,19 +355,22 @@ private Runnable buildProcessRequestHandler(ChannelHandlerContext ctx, RemotingC
     public void processResponseCommand(ChannelHandlerContext ctx, RemotingCommand cmd) {
         final int opaque = cmd.getOpaque();
         final ResponseFuture responseFuture = responseTable.get(opaque);
+        final String remoteAddr = ctx == null ? "" : RemotingHelper.parseChannelRemoteAddr(ctx.channel());
         if (responseFuture != null) {
             responseFuture.setResponseCommand(cmd);
 
             responseTable.remove(opaque);
 
+            doAfterRpcHooks(remoteAddr, responseFuture.getRequestCommand(), cmd);

Review Comment:
   u r right,  I didn't consider that aspect. So we should delete the doAfterRpcHooks in func invokeSync.



-- 
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] keranbingaa commented on a diff in pull request #6337: fix(remoting): fix forgetting doAfterRPCHooks in Async

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


##########
remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingAbstract.java:
##########
@@ -355,19 +355,22 @@ private Runnable buildProcessRequestHandler(ChannelHandlerContext ctx, RemotingC
     public void processResponseCommand(ChannelHandlerContext ctx, RemotingCommand cmd) {
         final int opaque = cmd.getOpaque();
         final ResponseFuture responseFuture = responseTable.get(opaque);
+        final String remoteAddr = ctx == null ? "" : RemotingHelper.parseChannelRemoteAddr(ctx.channel());
         if (responseFuture != null) {
             responseFuture.setResponseCommand(cmd);
 
             responseTable.remove(opaque);
 
+            doAfterRpcHooks(remoteAddr, responseFuture.getRequestCommand(), cmd);

Review Comment:
   maybe invokesync will call this method twice?



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


Re: [PR] fix(remoting): fix forgetting doAfterRPCHooks in Async [rocketmq]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #6337:
URL: https://github.com/apache/rocketmq/pull/6337#issuecomment-2027834718

   This PR is stale because it has been open for 365 days with no activity. It will be closed in 3 days if no further activity occurs. If you wish not to mark it as stale, please leave a comment in this PR.


-- 
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] FantasyChen-DH commented on a diff in pull request #6337: fix(remoting): fix forgetting doAfterRPCHooks in Async

Posted by "FantasyChen-DH (via GitHub)" <gi...@apache.org>.
FantasyChen-DH commented on code in PR #6337:
URL: https://github.com/apache/rocketmq/pull/6337#discussion_r1150614978


##########
remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingAbstract.java:
##########
@@ -355,19 +355,22 @@ private Runnable buildProcessRequestHandler(ChannelHandlerContext ctx, RemotingC
     public void processResponseCommand(ChannelHandlerContext ctx, RemotingCommand cmd) {
         final int opaque = cmd.getOpaque();
         final ResponseFuture responseFuture = responseTable.get(opaque);
+        final String remoteAddr = ctx == null ? "" : RemotingHelper.parseChannelRemoteAddr(ctx.channel());
         if (responseFuture != null) {
             responseFuture.setResponseCommand(cmd);
 
             responseTable.remove(opaque);
 
+            doAfterRpcHooks(remoteAddr, responseFuture.getRequestCommand(), cmd);

Review Comment:
   you mean maybe call this method twice due to network error such as receiving the same response at the same time, or other reasons? In my opinion, each execution will release the responseFuture so that it should not be executed multiple times.



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


Re: [PR] fix(remoting): fix forgetting doAfterRPCHooks in Async [rocketmq]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #6337:
URL: https://github.com/apache/rocketmq/pull/6337#issuecomment-2030825976

   This PR was closed because it has been inactive for 3 days since being marked as stale.


-- 
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 #6337: fix(remoting): fix forgetting doAfterRPCHooks in Async

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

   ## [Codecov](https://codecov.io/gh/apache/rocketmq/pull/6337?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 [#6337](https://codecov.io/gh/apache/rocketmq/pull/6337?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (abdc99d) into [develop](https://codecov.io/gh/apache/rocketmq/commit/fac699ea4dbcc006ba6a21d69a004c29ea4ac1a2?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (fac699e) will **increase** coverage by `0.13%`.
   > The diff coverage is `66.66%`.
   
   ```diff
   @@              Coverage Diff              @@
   ##             develop    #6337      +/-   ##
   =============================================
   + Coverage      43.01%   43.15%   +0.13%     
   - Complexity      8892     8925      +33     
   =============================================
     Files           1103     1103              
     Lines          77763    77841      +78     
     Branches       10126    10135       +9     
   =============================================
   + Hits           33453    33595     +142     
   + Misses         40118    40042      -76     
   - Partials        4192     4204      +12     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/rocketmq/pull/6337?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...rocketmq/remoting/netty/NettyRemotingAbstract.java](https://codecov.io/gh/apache/rocketmq/pull/6337?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVtb3Rpbmcvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3JvY2tldG1xL3JlbW90aW5nL25ldHR5L05ldHR5UmVtb3RpbmdBYnN0cmFjdC5qYXZh) | `52.22% <66.66%> (+0.62%)` | :arrow_up: |
   
   ... and [41 files with indirect coverage changes](https://codecov.io/gh/apache/rocketmq/pull/6337/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] aaron-ai commented on a diff in pull request #6337: fix(remoting): fix forgetting doAfterRPCHooks in Async

Posted by "aaron-ai (via GitHub)" <gi...@apache.org>.
aaron-ai commented on code in PR #6337:
URL: https://github.com/apache/rocketmq/pull/6337#discussion_r1150096591


##########
remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingAbstract.java:
##########
@@ -355,19 +355,22 @@ private Runnable buildProcessRequestHandler(ChannelHandlerContext ctx, RemotingC
     public void processResponseCommand(ChannelHandlerContext ctx, RemotingCommand cmd) {
         final int opaque = cmd.getOpaque();
         final ResponseFuture responseFuture = responseTable.get(opaque);
+        final String remoteAddr = ctx == null ? "" : RemotingHelper.parseChannelRemoteAddr(ctx.channel());
         if (responseFuture != null) {
             responseFuture.setResponseCommand(cmd);
 
             responseTable.remove(opaque);
 
+            doAfterRpcHooks(remoteAddr, responseFuture.getRequestCommand(), cmd);
+
             if (responseFuture.getInvokeCallback() != null) {
                 executeInvokeCallback(responseFuture);
             } else {
                 responseFuture.putResponse(cmd);
                 responseFuture.release();
             }
         } else {
-            log.warn("receive response, but not matched any request, " + RemotingHelper.parseChannelRemoteAddr(ctx.channel()));
+            log.warn("receive response, but not matched any request, " + remoteAddr);

Review Comment:
   ```suggestion
               log.warn("receive response, but not matched any request, remote address={}", remoteAddr);
   ```



-- 
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] echooymxq commented on pull request #6337: fix(remoting): fix forgetting doAfterRPCHooks in Async

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

   close #6379 


-- 
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] keranbingaa commented on a diff in pull request #6337: fix(remoting): fix forgetting doAfterRPCHooks in Async

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


##########
remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingAbstract.java:
##########
@@ -355,19 +355,22 @@ private Runnable buildProcessRequestHandler(ChannelHandlerContext ctx, RemotingC
     public void processResponseCommand(ChannelHandlerContext ctx, RemotingCommand cmd) {
         final int opaque = cmd.getOpaque();
         final ResponseFuture responseFuture = responseTable.get(opaque);
+        final String remoteAddr = ctx == null ? "" : RemotingHelper.parseChannelRemoteAddr(ctx.channel());
         if (responseFuture != null) {
             responseFuture.setResponseCommand(cmd);
 
             responseTable.remove(opaque);
 
+            doAfterRpcHooks(remoteAddr, responseFuture.getRequestCommand(), cmd);

Review Comment:
   I mean in func invokesync of NettyRemotingClient, the doAfterRpcHooks is called now, if you call doAfterRpcHooks in this place, may the doAfterRpcHooks will be called twice?



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


Re: [PR] fix(remoting): fix forgetting doAfterRPCHooks in Async [rocketmq]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed pull request #6337: fix(remoting): fix forgetting doAfterRPCHooks in Async
URL: https://github.com/apache/rocketmq/pull/6337


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