You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2018/04/25 09:40:32 UTC

[GitHub] stefli commented on issue #1637: Issue about the provider side parameter validation

stefli commented on issue #1637: Issue about the provider side parameter validation
URL: https://github.com/apache/incubator-dubbo/issues/1637#issuecomment-383489158
 
 
   @chickenlj @ralf0131 
   Latest news:
   After some tests, we found that this issue only occured when using url="dubbo://xxx" in local environment. 
   
   - **Scene (Use url property, such as url="dubbo://localhost:20880")**
   
   Invoker -> ExceptionFilter -> ValidationFilter -> Vadation Failed -> DefaultFuture
   
   The method returnFromResponse  of the class DefaultFurture will wrap the ConstraintViolationException to RemotingException when RpcResult status is not equal to OK/TIMEOUT, and return to consumer side. Then we can't convert RemotingExceptioin to ConstraitViolationException to get all the validation errors.
   1. return new RpcExeption(t.getMessage(), t) - old version
   Just wrap the ConstraintViolationException to RemotingException, unfriendly to consumer side.
   2. return new RpcResult(t) - latest version
   Throw a hession serialization issue as mentioned before, **seems the validation happened on the provider side.**
   
   Code snippet of DefaultFuture.class:
   ```
   private Object returnFromResponse() throws RemotingException {
           Response res = response;
           if (res == null) {
               throw new IllegalStateException("response cannot be null");
           }
           if (res.getStatus() == Response.OK) {
               return res.getResult();
           }
           if (res.getStatus() == Response.CLIENT_TIMEOUT || res.getStatus() == Response.SERVER_TIMEOUT) {
               throw new TimeoutException(res.getStatus() == Response.SERVER_TIMEOUT, channel, res.getErrorMessage());
           }
           throw new RemotingException(channel, res.getErrorMessage()); 
       }
   ```
   
   **Conclusion: Only the customization might fix the issue or DO NOT use this configuration when using validation.**
   
   - **Scene (without url property)**
   
   Works fine. But, it **seems the validation happened on the consumer side, not really on the provider side.**
   
   **Conclusion: Works fine, but can't solve the validation issue when debug in local environment.**
   
   Pls help confirm.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org