[jira] [Commented] (SCB-827) Add response decode error log
[ https://issues.apache.org/jira/browse/SCB-827?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16579435#comment-16579435 ] ASF GitHub Bot commented on SCB-827: liubao68 closed pull request #865: [SCB-827] Add response body decoding error log URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/865 This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/demo/demo-springmvc/springmvc-client/src/main/java/org/apache/servicecomb/demo/springmvc/client/CodeFirstSpringmvcIntf.java b/demo/demo-springmvc/springmvc-client/src/main/java/org/apache/servicecomb/demo/springmvc/client/CodeFirstSpringmvcIntf.java index c2f5cc50d..509e15c7a 100644 --- a/demo/demo-springmvc/springmvc-client/src/main/java/org/apache/servicecomb/demo/springmvc/client/CodeFirstSpringmvcIntf.java +++ b/demo/demo-springmvc/springmvc-client/src/main/java/org/apache/servicecomb/demo/springmvc/client/CodeFirstSpringmvcIntf.java @@ -27,6 +27,7 @@ import org.apache.servicecomb.demo.compute.GenericParam; import org.apache.servicecomb.demo.compute.Person; import org.apache.servicecomb.demo.server.User; +import org.apache.servicecomb.demo.springmvc.decoderesponse.DecodeTestResponse; import org.apache.servicecomb.swagger.invocation.Response; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; @@ -72,4 +73,6 @@ String checkQueryGenericString(String str, GenericParam requestBody, lon String testDelay(); String testAbort(); + + DecodeTestResponse testDecodeResponseError(); } diff --git a/demo/demo-springmvc/springmvc-client/src/main/java/org/apache/servicecomb/demo/springmvc/client/TestResponse.java b/demo/demo-springmvc/springmvc-client/src/main/java/org/apache/servicecomb/demo/springmvc/client/TestResponse.java index e243a2f50..0cd60284f 100644 --- a/demo/demo-springmvc/springmvc-client/src/main/java/org/apache/servicecomb/demo/springmvc/client/TestResponse.java +++ b/demo/demo-springmvc/springmvc-client/src/main/java/org/apache/servicecomb/demo/springmvc/client/TestResponse.java @@ -17,7 +17,9 @@ package org.apache.servicecomb.demo.springmvc.client; import java.util.Date; +import java.util.Objects; +import org.apache.servicecomb.core.exception.CseException; import org.apache.servicecomb.demo.TestMgr; import org.apache.servicecomb.demo.compute.GenericParam; import org.apache.servicecomb.demo.compute.Person; @@ -27,6 +29,8 @@ import org.apache.servicecomb.swagger.invocation.exception.InvocationException; import org.springframework.http.ResponseEntity; +import com.fasterxml.jackson.databind.exc.InvalidFormatException; + public class TestResponse { private CodeFirstSpringmvcIntf intf; @@ -39,6 +43,7 @@ public void runRest() { checkQueryGenericString(); testDelay(); testAbort(); +testDecodeResponseError(); } public void runHighway() { @@ -130,4 +135,32 @@ private void testAbort() { + "OK|InvocationException: code=421;msg=CommonExceptionData [message=aborted by fault inject]|", result.toString()); } + + private void testDecodeResponseError() { +InvocationException exception = null; +try { + intf.testDecodeResponseError(); +} catch (InvocationException e) { + // 1. InvocationException: wrapper exception + exception = e; +} +Objects.requireNonNull(exception); +// 2. CseException: bizKeeper exception +Throwable wrappedException = exception.getCause(); +TestMgr.check(CseException.class, wrappedException.getClass()); +// 3. InvocationException: decoder wrapping exception +wrappedException = wrappedException.getCause(); +TestMgr.check(InvocationException.class, wrappedException.getClass()); +TestMgr.check("InvocationException: code=490;msg=CommonExceptionData [message=Cse Internal Bad Request]", +wrappedException.getMessage()); +// 4. InvalidFormatException: decode exception +Object cause = wrappedException.getCause(); +TestMgr.check(InvalidFormatException.class, cause.getClass()); +TestMgr.check( +"Cannot deserialize value of type `java.util.Date` from String \"returnOK\": not a valid representation " ++ "(error: Failed to parse Date value 'returnOK': Failed to parse date \"returnOK\": Invalid number: retu)\n" ++ " at [Source: (org.apache.servicecomb.foundation.vertx.stream.BufferInputStream); line: 1, column: 12] " ++ "(through reference chain: org.apache.servicecomb.demo.springmvc.decoderesponse.DecodeTestResponse[\"content\"])", +((InvalidFormatException) cause).getMessage()); + } } diff --git a/demo/demo-springmvc/springmvc-client/src/main/java
[jira] [Commented] (SCB-827) Add response decode error log
[ https://issues.apache.org/jira/browse/SCB-827?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16579314#comment-16579314 ] ASF GitHub Bot commented on SCB-827: coveralls edited a comment on issue #865: [SCB-827] Add response body decoding error log URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/865#issuecomment-411738057 [![Coverage Status](https://coveralls.io/builds/18470873/badge)](https://coveralls.io/builds/18470873) Coverage decreased (-0.08%) to 86.401% when pulling **d09bae826bf8996f84cf54881fc3ec2e814f53c0 on yhs0092:fix_DefaultHttpClientFilter_confusing_response** into **a30e796134ffbbed278365237d32775fa6c9eef5 on apache:master**. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Add response decode error log > - > > Key: SCB-827 > URL: https://issues.apache.org/jira/browse/SCB-827 > Project: Apache ServiceComb > Issue Type: Improvement >Reporter: YaoHaishi >Assignee: YaoHaishi >Priority: Major > > In DefaultHttpClientFilter.extractResult(), once response decode error > occurs, it will be caught and set into an InvocationException, and the > InvocationException will be treated as response body, which will cause > confusing result. > We need to print some logs to help developers locate such problem. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (SCB-827) Add response decode error log
[ https://issues.apache.org/jira/browse/SCB-827?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16579194#comment-16579194 ] ASF GitHub Bot commented on SCB-827: wujimin commented on a change in pull request #865: [SCB-827] Add response body decoding error log URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/865#discussion_r209819047 ## File path: transports/transport-rest/transport-rest-client/src/main/java/org/apache/servicecomb/transport/rest/client/http/DefaultHttpClientFilter.java ## @@ -79,13 +82,15 @@ protected Object extractResult(Invocation invocation, HttpServletResponseEx resp responseEx.getStatus(), responseEx.getStatusType().getReasonPhrase(), responseEx.getHeader(HttpHeaders.CONTENT_TYPE)); + LOGGER.error(msg); return ExceptionFactory.createConsumerException(new InvocationException(responseEx.getStatus(), responseEx.getStatusType().getReasonPhrase(), msg)); } try { return produceProcessor.decodeResponse(responseEx.getBodyBuffer(), responseMeta.getJavaType()); } catch (Exception e) { - return ExceptionFactory.createConsumerException(e); + LOGGER.error("failed to decode response body", e); + throw ExceptionFactory.createConsumerException(e); Review comment: that will missed handler asyncResponse callback process. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Add response decode error log > - > > Key: SCB-827 > URL: https://issues.apache.org/jira/browse/SCB-827 > Project: Apache ServiceComb > Issue Type: Improvement >Reporter: YaoHaishi >Assignee: YaoHaishi >Priority: Major > > In DefaultHttpClientFilter.extractResult(), once response decode error > occurs, it will be caught and set into an InvocationException, and the > InvocationException will be treated as response body, which will cause > confusing result. > We need to print some logs to help developers locate such problem. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (SCB-827) Add response decode error log
[ https://issues.apache.org/jira/browse/SCB-827?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16577628#comment-16577628 ] ASF GitHub Bot commented on SCB-827: yhs0092 commented on a change in pull request #865: [SCB-827] Add response body decoding error log URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/865#discussion_r209459205 ## File path: transports/transport-rest/transport-rest-client/src/main/java/org/apache/servicecomb/transport/rest/client/http/DefaultHttpClientFilter.java ## @@ -79,13 +82,15 @@ protected Object extractResult(Invocation invocation, HttpServletResponseEx resp responseEx.getStatus(), responseEx.getStatusType().getReasonPhrase(), responseEx.getHeader(HttpHeaders.CONTENT_TYPE)); + LOGGER.error(msg); return ExceptionFactory.createConsumerException(new InvocationException(responseEx.getStatus(), responseEx.getStatusType().getReasonPhrase(), msg)); } try { return produceProcessor.decodeResponse(responseEx.getBodyBuffer(), responseMeta.getJavaType()); } catch (Exception e) { - return ExceptionFactory.createConsumerException(e); + LOGGER.error("failed to decode response body", e); + throw ExceptionFactory.createConsumerException(e); Review comment: Get it.. Maybe we can throw the `InvocationException` directly? After all, a none 2xx response will be transferred into an `Exception` in `Invoker.syncInvoke()` and `CseClientHttpRequest.invoke()`. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Add response decode error log > - > > Key: SCB-827 > URL: https://issues.apache.org/jira/browse/SCB-827 > Project: Apache ServiceComb > Issue Type: Improvement >Reporter: YaoHaishi >Assignee: YaoHaishi >Priority: Major > > In DefaultHttpClientFilter.extractResult(), once response decode error > occurs, it will be caught and set into an InvocationException, and the > InvocationException will be treated as response body, which will cause > confusing result. > We need to print some logs to help developers locate such problem. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (SCB-827) Add response decode error log
[ https://issues.apache.org/jira/browse/SCB-827?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16577457#comment-16577457 ] ASF GitHub Bot commented on SCB-827: wujimin commented on a change in pull request #865: [SCB-827] Add response body decoding error log URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/865#discussion_r209447470 ## File path: transports/transport-rest/transport-rest-client/src/main/java/org/apache/servicecomb/transport/rest/client/http/DefaultHttpClientFilter.java ## @@ -79,13 +82,15 @@ protected Object extractResult(Invocation invocation, HttpServletResponseEx resp responseEx.getStatus(), responseEx.getStatusType().getReasonPhrase(), responseEx.getHeader(HttpHeaders.CONTENT_TYPE)); + LOGGER.error(msg); return ExceptionFactory.createConsumerException(new InvocationException(responseEx.getStatus(), responseEx.getStatusType().getReasonPhrase(), msg)); } try { return produceProcessor.decodeResponse(responseEx.getBodyBuffer(), responseMeta.getJavaType()); } catch (Exception e) { - return ExceptionFactory.createConsumerException(e); + LOGGER.error("failed to decode response body", e); + throw ExceptionFactory.createConsumerException(e); Review comment: oh, i means result of the method change form "result" to "Response" otherwise line 86 still have problem. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Add response decode error log > - > > Key: SCB-827 > URL: https://issues.apache.org/jira/browse/SCB-827 > Project: Apache ServiceComb > Issue Type: Improvement >Reporter: YaoHaishi >Assignee: YaoHaishi >Priority: Major > > In DefaultHttpClientFilter.extractResult(), once response decode error > occurs, it will be caught and set into an InvocationException, and the > InvocationException will be treated as response body, which will cause > confusing result. > We need to print some logs to help developers locate such problem. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (SCB-827) Add response decode error log
[ https://issues.apache.org/jira/browse/SCB-827?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16575874#comment-16575874 ] ASF GitHub Bot commented on SCB-827: yhs0092 commented on a change in pull request #865: [SCB-827] Add response body decoding error log URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/865#discussion_r209167388 ## File path: transports/transport-rest/transport-rest-client/src/main/java/org/apache/servicecomb/transport/rest/client/http/DefaultHttpClientFilter.java ## @@ -79,13 +82,15 @@ protected Object extractResult(Invocation invocation, HttpServletResponseEx resp responseEx.getStatus(), responseEx.getStatusType().getReasonPhrase(), responseEx.getHeader(HttpHeaders.CONTENT_TYPE)); + LOGGER.error(msg); return ExceptionFactory.createConsumerException(new InvocationException(responseEx.getStatus(), responseEx.getStatusType().getReasonPhrase(), msg)); } try { return produceProcessor.decodeResponse(responseEx.getBodyBuffer(), responseMeta.getJavaType()); } catch (Exception e) { - return ExceptionFactory.createConsumerException(e); + LOGGER.error("failed to decode response body", e); + throw ExceptionFactory.createConsumerException(e); Review comment: OK, please review again. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Add response decode error log > - > > Key: SCB-827 > URL: https://issues.apache.org/jira/browse/SCB-827 > Project: Apache ServiceComb > Issue Type: Improvement >Reporter: YaoHaishi >Assignee: YaoHaishi >Priority: Major > > In DefaultHttpClientFilter.extractResult(), once response decode error > occurs, it will be caught and set into an InvocationException, and the > InvocationException will be treated as response body, which will cause > confusing result. > We need to print some logs to help developers locate such problem. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (SCB-827) Add response decode error log
[ https://issues.apache.org/jira/browse/SCB-827?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16575867#comment-16575867 ] ASF GitHub Bot commented on SCB-827: coveralls edited a comment on issue #865: [SCB-827] Add response body decoding error log URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/865#issuecomment-411738057 [![Coverage Status](https://coveralls.io/builds/18420896/badge)](https://coveralls.io/builds/18420896) Coverage decreased (-0.05%) to 86.427% when pulling **6af4742e271dad9cabdde6b3a7d0c440701a012e on yhs0092:fix_DefaultHttpClientFilter_confusing_response** into **a30e796134ffbbed278365237d32775fa6c9eef5 on apache:master**. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Add response decode error log > - > > Key: SCB-827 > URL: https://issues.apache.org/jira/browse/SCB-827 > Project: Apache ServiceComb > Issue Type: Improvement >Reporter: YaoHaishi >Assignee: YaoHaishi >Priority: Major > > In DefaultHttpClientFilter.extractResult(), once response decode error > occurs, it will be caught and set into an InvocationException, and the > InvocationException will be treated as response body, which will cause > confusing result. > We need to print some logs to help developers locate such problem. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (SCB-827) Add response decode error log
[ https://issues.apache.org/jira/browse/SCB-827?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16575721#comment-16575721 ] ASF GitHub Bot commented on SCB-827: wujimin commented on a change in pull request #865: [SCB-827] Add response body decoding error log URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/865#discussion_r209136800 ## File path: transports/transport-rest/transport-rest-client/src/main/java/org/apache/servicecomb/transport/rest/client/http/DefaultHttpClientFilter.java ## @@ -79,13 +82,15 @@ protected Object extractResult(Invocation invocation, HttpServletResponseEx resp responseEx.getStatus(), responseEx.getStatusType().getReasonPhrase(), responseEx.getHeader(HttpHeaders.CONTENT_TYPE)); + LOGGER.error(msg); return ExceptionFactory.createConsumerException(new InvocationException(responseEx.getStatus(), responseEx.getStatusType().getReasonPhrase(), msg)); } try { return produceProcessor.decodeResponse(responseEx.getBodyBuffer(), responseMeta.getJavaType()); } catch (Exception e) { - return ExceptionFactory.createConsumerException(e); + LOGGER.error("failed to decode response body", e); + throw ExceptionFactory.createConsumerException(e); Review comment: change "extractResult" to "extractResponse"? This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Add response decode error log > - > > Key: SCB-827 > URL: https://issues.apache.org/jira/browse/SCB-827 > Project: Apache ServiceComb > Issue Type: Improvement >Reporter: YaoHaishi >Assignee: YaoHaishi >Priority: Major > > In DefaultHttpClientFilter.extractResult(), once response decode error > occurs, it will be caught and set into an InvocationException, and the > InvocationException will be treated as response body, which will cause > confusing result. > We need to print some logs to help developers locate such problem. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (SCB-827) Add response decode error log
[ https://issues.apache.org/jira/browse/SCB-827?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16574838#comment-16574838 ] ASF GitHub Bot commented on SCB-827: coveralls edited a comment on issue #865: [SCB-827] Add response body decoding error log URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/865#issuecomment-411738057 [![Coverage Status](https://coveralls.io/builds/18405592/badge)](https://coveralls.io/builds/18405592) Coverage decreased (-0.05%) to 85.006% when pulling **13e0464880ca2a0c4f49508bbe9b67b5c9367088 on yhs0092:fix_DefaultHttpClientFilter_confusing_response** into **3edca801fe18fd6f93805bdf97f62aae58c99284 on apache:master**. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Add response decode error log > - > > Key: SCB-827 > URL: https://issues.apache.org/jira/browse/SCB-827 > Project: Apache ServiceComb > Issue Type: Improvement >Reporter: YaoHaishi >Assignee: YaoHaishi >Priority: Major > > In DefaultHttpClientFilter.extractResult(), once response decode error > occurs, it will be caught and set into an InvocationException, and the > InvocationException will be treated as response body, which will cause > confusing result. > We need to print some logs to help developers locate such problem. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (SCB-827) Add response decode error log
[ https://issues.apache.org/jira/browse/SCB-827?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16574757#comment-16574757 ] ASF GitHub Bot commented on SCB-827: coveralls commented on issue #865: [SCB-827] Add response body decoding error log URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/865#issuecomment-411738057 [![Coverage Status](https://coveralls.io/builds/18404459/badge)](https://coveralls.io/builds/18404459) Coverage decreased (-0.05%) to 85.006% when pulling **4264e59fa281c9d872f8597965529ea8fd9f801a on yhs0092:fix_DefaultHttpClientFilter_confusing_response** into **3edca801fe18fd6f93805bdf97f62aae58c99284 on apache:master**. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Add response decode error log > - > > Key: SCB-827 > URL: https://issues.apache.org/jira/browse/SCB-827 > Project: Apache ServiceComb > Issue Type: Improvement >Reporter: YaoHaishi >Assignee: YaoHaishi >Priority: Major > > In DefaultHttpClientFilter.extractResult(), once response decode error > occurs, it will be caught and set into an InvocationException, and the > InvocationException will be treated as response body, which will cause > confusing result. > We need to print some logs to help developers locate such problem. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (SCB-827) Add response decode error log
[ https://issues.apache.org/jira/browse/SCB-827?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16574739#comment-16574739 ] ASF GitHub Bot commented on SCB-827: yhs0092 opened a new pull request #865: [SCB-827] Add response body decoding error log URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/865 Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Make sure there is a [JIRA issue](https://issues.apache.org/jira/browse/SCB) filed for the change (usually before you start working on it). Trivial changes like typos do not require a JIRA issue. Your pull request should address just this issue, without pulling in other changes. - [x] Each commit in the pull request should have a meaningful subject line and body. - [x] Format the pull request title like `[SCB-XXX] Fixes bug in ApproximateQuantiles`, where you replace `SCB-XXX` with the appropriate JIRA issue. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Run `mvn clean install` to make sure basic checks pass. A more thorough check will be performed on your pull request automatically. - [ ] If this contribution is large, please file an Apache [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf). --- See details in [SCB-827](https://issues.apache.org/jira/browse/SCB-827) This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Add response decode error log > - > > Key: SCB-827 > URL: https://issues.apache.org/jira/browse/SCB-827 > Project: Apache ServiceComb > Issue Type: Improvement >Reporter: YaoHaishi >Assignee: YaoHaishi >Priority: Major > > In DefaultHttpClientFilter.extractResult(), once response decode error > occurs, it will be caught and set into an InvocationException, and the > InvocationException will be treated as response body, which will cause > confusing result. > We need to print some logs to help developers locate such problem. -- This message was sent by Atlassian JIRA (v7.6.3#76005)