You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/11/07 07:22:35 UTC

[GitHub] [pulsar] TakaHiR07 opened a new pull request, #18363: [fix][broker] fix log error in exceptionCaught

TakaHiR07 opened a new pull request, #18363:
URL: https://github.com/apache/pulsar/pull/18363

   ### Motivation
   
   Fix log error in exceptionCaught
   
   ### Modifications
   
   
   
   ### Documentation
   
   <!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
   
   - [ ] `doc` <!-- Your PR contains doc changes. Please attach the local preview screenshots (run `sh start.sh` at `pulsar/site2/website`) to your PR description, or else your PR might not get merged. -->
   - [ ] `doc-required` <!-- Your PR changes impact docs and you will update later -->
   - [x] `doc-not-needed` <!-- Your PR changes do not impact docs -->
   - [ ] `doc-complete` <!-- Docs have been already added -->
   
   ### Matching PR in forked repository
   
   PR in forked repository: <!-- ENTER URL HERE -->
   
   <!--
   After opening this PR, the build in apache/pulsar will fail and instructions will
   be provided for opening a PR in the PR author's forked repository.
   
   apache/pulsar pull requests should be first tested in your own fork since the 
   apache/pulsar CI based on GitHub Actions has constrained resources and quota.
   GitHub Actions provides separate quota for pull requests that are executed in 
   a forked repository.
   
   The tests will be run in the forked repository until all PR review comments have
   been handled, the tests pass and the PR is approved by a reviewer.
   -->
   


-- 
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@pulsar.apache.org

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


[GitHub] [pulsar] tisonkun commented on a diff in pull request #18363: [fix][broker] fix log error in exceptionCaught

Posted by GitBox <gi...@apache.org>.
tisonkun commented on code in PR #18363:
URL: https://github.com/apache/pulsar/pull/18363#discussion_r1018687972


##########
pulsar-proxy/src/main/java/org/apache/pulsar/proxy/server/ProxyConnection.java:
##########
@@ -209,7 +209,7 @@ public synchronized void channelInactive(ChannelHandlerContext ctx) throws Excep
     @Override
     public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
         super.exceptionCaught(ctx, cause);
-        LOG.warn("[{}] Got exception {} : Message: {} State: {}", remoteAddress, cause.getClass().getSimpleName(),
+        LOG.warn("[{}] Got exception {} : Message: {} State: {} Cause: {}", remoteAddress, cause.getClass().getSimpleName(),
                 cause.getMessage(), state,
                 ClientCnx.isKnownException(cause) ? null : cause);

Review Comment:
   ```suggestion
   ```suggestion
           if (ClientCnx.isKnownException(cause)) {
               LOG.warn("[{}] Got exception {} : Message: {} State: {}",
                       remoteAddress, cause.getClass().getSimpleName(), cause.getMessage(), state);
           } else {
               LOG.warn("[{}] Got exception {} : Message: {} State: {}",
                       remoteAddress, cause.getClass().getSimpleName(), cause.getMessage(), state, cause);
           }
   ```
   
   To stop the IDEA complaining, you can make this change.
   ```



##########
pulsar-proxy/src/main/java/org/apache/pulsar/proxy/server/ProxyConnection.java:
##########
@@ -209,7 +209,7 @@ public synchronized void channelInactive(ChannelHandlerContext ctx) throws Excep
     @Override
     public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
         super.exceptionCaught(ctx, cause);
-        LOG.warn("[{}] Got exception {} : Message: {} State: {}", remoteAddress, cause.getClass().getSimpleName(),
+        LOG.warn("[{}] Got exception {} : Message: {} State: {} Cause: {}", remoteAddress, cause.getClass().getSimpleName(),
                 cause.getMessage(), state,
                 ClientCnx.isKnownException(cause) ? null : cause);

Review Comment:
   
   ```suggestion
           if (ClientCnx.isKnownException(cause)) {
               LOG.warn("[{}] Got exception {} : Message: {} State: {}",
                       remoteAddress, cause.getClass().getSimpleName(), cause.getMessage(), state);
           } else {
               LOG.warn("[{}] Got exception {} : Message: {} State: {}",
                       remoteAddress, cause.getClass().getSimpleName(), cause.getMessage(), state, cause);
           }
   ```
   
   To stop the IDEA complaining, you can make this change.



-- 
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@pulsar.apache.org

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


[GitHub] [pulsar] tisonkun commented on a diff in pull request #18363: [fix][broker] fix log error in exceptionCaught

Posted by GitBox <gi...@apache.org>.
tisonkun commented on code in PR #18363:
URL: https://github.com/apache/pulsar/pull/18363#discussion_r1018689504


##########
pulsar-proxy/src/main/java/org/apache/pulsar/proxy/server/ProxyConnection.java:
##########
@@ -209,7 +209,7 @@ public synchronized void channelInactive(ChannelHandlerContext ctx) throws Excep
     @Override
     public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
         super.exceptionCaught(ctx, cause);
-        LOG.warn("[{}] Got exception {} : Message: {} State: {}", remoteAddress, cause.getClass().getSimpleName(),
+        LOG.warn("[{}] Got exception {} : Message: {} State: {} Cause: {}", remoteAddress, cause.getClass().getSimpleName(),
                 cause.getMessage(), state,
                 ClientCnx.isKnownException(cause) ? null : cause);

Review Comment:
   Or:
   
   ```java
           LOG.warn("[{}] Got exception {} : Message: {} State: {}",
                   remoteAddress, cause.getClass().getSimpleName(), cause.getMessage(), state,
                   ClientCnx.filterKnownException(cause));
   
   // in ClientCnx.java
   
       public static Throwable filterKnownException(Throwable t) {
           return isKnownException(t) ? null : t;
       }
   ```
   
   It's somehow IDEA shortcoming.



-- 
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@pulsar.apache.org

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


[GitHub] [pulsar] tisonkun commented on a diff in pull request #18363: [fix][broker] fix log error in exceptionCaught

Posted by GitBox <gi...@apache.org>.
tisonkun commented on code in PR #18363:
URL: https://github.com/apache/pulsar/pull/18363#discussion_r1018687646


##########
pulsar-proxy/src/main/java/org/apache/pulsar/proxy/server/ProxyConnection.java:
##########
@@ -209,7 +209,7 @@ public synchronized void channelInactive(ChannelHandlerContext ctx) throws Excep
     @Override
     public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
         super.exceptionCaught(ctx, cause);
-        LOG.warn("[{}] Got exception {} : Message: {} State: {}", remoteAddress, cause.getClass().getSimpleName(),
+        LOG.warn("[{}] Got exception {} : Message: {} State: {} Cause: {}", remoteAddress, cause.getClass().getSimpleName(),

Review Comment:
   ```suggestion
           if (ClientCnx.isKnownException(cause)) {
               LOG.warn("[{}] Got exception {} : Message: {} State: {}",
                       remoteAddress, cause.getClass().getSimpleName(), cause.getMessage(), state, cause);
           } else {
               LOG.warn("[{}] Got exception {} : Message: {} State: {}",
                       remoteAddress, cause.getClass().getSimpleName(), cause.getMessage(), state);
           }
   ```
   
   To stop the IDEA complaining, you can make this change.



-- 
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@pulsar.apache.org

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


[GitHub] [pulsar] TakaHiR07 closed pull request #18363: [fix][broker] fix log error in exceptionCaught

Posted by GitBox <gi...@apache.org>.
TakaHiR07 closed pull request #18363: [fix][broker] fix log error in exceptionCaught
URL: https://github.com/apache/pulsar/pull/18363


-- 
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@pulsar.apache.org

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


[GitHub] [pulsar] TakaHiR07 commented on a diff in pull request #18363: [fix][broker] fix log error in exceptionCaught

Posted by GitBox <gi...@apache.org>.
TakaHiR07 commented on code in PR #18363:
URL: https://github.com/apache/pulsar/pull/18363#discussion_r1018718642


##########
pulsar-proxy/src/main/java/org/apache/pulsar/proxy/server/ProxyConnection.java:
##########
@@ -209,7 +209,7 @@ public synchronized void channelInactive(ChannelHandlerContext ctx) throws Excep
     @Override
     public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
         super.exceptionCaught(ctx, cause);
-        LOG.warn("[{}] Got exception {} : Message: {} State: {}", remoteAddress, cause.getClass().getSimpleName(),
+        LOG.warn("[{}] Got exception {} : Message: {} State: {} Cause: {}", remoteAddress, cause.getClass().getSimpleName(),
                 cause.getMessage(), state,
                 ClientCnx.isKnownException(cause) ? null : cause);

Review Comment:
   > Or:
   > 
   > ```java
   >         LOG.warn("[{}] Got exception {} : Message: {} State: {}",
   >                 remoteAddress, cause.getClass().getSimpleName(), cause.getMessage(), state,
   >                 ClientCnx.filterKnownException(cause));
   > 
   > // in ClientCnx.java
   > 
   >     public static Throwable filterKnownException(Throwable t) {
   >         return isKnownException(t) ? null : t;
   >     }
   > ```
   > 
   > It's somehow IDEA shortcoming.
   
   @tisonkun You are right, I am misled by idea complain. 



-- 
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@pulsar.apache.org

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