envoyproxy / envoy

Cloud-native high-performance edge/middle/service proxy
https://www.envoyproxy.io
Apache License 2.0
24.95k stars 4.8k forks source link

dubbo-proxy route_config group not effective #22032

Closed 13567436138 closed 2 years ago

13567436138 commented 2 years ago

If you are reporting any crash or any potential security issue, do not open an issue in this repo. Please report the issue via emailing envoy-security@googlegroups.com where the issue will be triaged appropriately.

Title: One line description dubbo-proxy route_config group not effective Description:

What issue is being seen? Describe what should be happening instead of the bug, for example: Envoy should not crash, the expected value isn't returned, etc.

Repro steps:

Include sample requests, environment, etc. All data and inputs required to reproduce the bug.

apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
  name: envoyfilter-dubbo-proxy
spec:
  workloadSelector:
    labels:
      app: dubbo-hello-consumer
  configPatches:
  - applyTo: NETWORK_FILTER
    match:
      listener:
        name: 10.68.242.66_20880
        filterChain:
          filter:
            name: "envoy.filters.network.tcp_proxy"
    patch:
      operation: REPLACE
      value:
        name: envoy.filters.network.dubbo_proxy
        typed_config:
          "@type": type.googleapis.com/envoy.extensions.filters.network.dubbo_proxy.v3.DubboProxy
          stat_prefix: outbound|20880||org.example.api
          protocol_type: Dubbo
          serialization_type: Hessian2
          route_config:
          - name: outbound|20880||org.example.api.IGroupService1
            interface: org.example.api.IGroupService
            group: group1
            routes:
            - match:
                method:
                  name:
                    exact: dubboCallProiderService
              route:
                cluster: outbound|20880|v1|dubbo-hello-provider.istio.svc.cluster.local
          - name: outbound|20880||org.example.api.IGroupService2
            interface: org.example.api.IGroupService
            group: group2
            routes:
            - match:
                method:
                  name:
                    exact: dubboCallProiderService
              route:
                cluster: outbound|20880|v2|dubbo-hello-provider.istio.svc.cluster.local
          - name: outbound|20880||org.example.api.IVersionService1
            interface: org.example.api.IVersionService
            version: 1.0.0
            routes:
            - match:
                method:
                  name:
                    exact: dubboCallProiderService
              route:
                cluster: outbound|20880|v1|dubbo-hello-provider.istio.svc.cluster.local
          - name: outbound|20880||org.example.api.IVersionService2
            interface: org.example.api.IVersionService
            version: 2.0.0
            routes:
            - match:
                method:
                  name:
                    exact: dubboCallProiderService
              route:
                cluster: outbound|20880|v2|dubbo-hello-provider.istio.svc.cluster.local
          - name: outbound|20880||org.example.api.ITestService
            interface: org.example.api.ITestService
            routes:
            - match:
                method:
                  name:
                    exact: dubboCallProiderService
              route:
                cluster: outbound|20880|v2|dubbo-hello-provider.istio.svc.cluster.local
|
package org.example;

import org.apache.dubbo.config.annotation.DubboReference;
import org.apache.dubbo.config.spring.context.annotation.EnableDubboConfig;
import org.example.api.IGroupService;
import org.example.api.ITestService;
import org.example.api.IVersionService;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

@SpringBootApplication
@EnableDubboConfig
@Controller
public class DubboconsumerApplication {
    @DubboReference(url="dubbo://dubbo-hello-provider:20880",check = false)
    private ITestService testService;
    @DubboReference(url="dubbo://dubbo-hello-provider:20880",check = false,group = "group1")
    private IGroupService iGroupService;
    @DubboReference(url="dubbo://dubbo-hello-provider:20880",check = false,group = "group2")
    private IGroupService iGroupService2;
    @DubboReference(url="dubbo://dubbo-hello-provider:20880",check = false,version = "1.0.0")
    private IVersionService iVersionService;
    @DubboReference(url="dubbo://dubbo-hello-provider:20880",check = false,version = "2.0.0")
    private IVersionService iVersionService2;

    public static void main(String[] args) {
        SpringApplication.run(DubboconsumerApplication.class, args);
    }

    /**
     * 测试
     * @param id 消息
     * @return 结果
     */
    @RequestMapping("/test")
    @ResponseBody
    public String test(@RequestParam("id") int id) {
        String result = testService.dubboCallProiderService(String.valueOf(id));
        return result;
    }

    @RequestMapping("/test/group1")
    @ResponseBody
    public String testgroup(@RequestParam("id") int id) {
        String result = iGroupService.dubboCallProiderService(String.valueOf(id));
        return result;
    }

    @RequestMapping("/test/group2")
    @ResponseBody
    public String testgroup2(@RequestParam("id") int id) {
        String result = iGroupService2.dubboCallProiderService(String.valueOf(id));
        return result;
    }

    @RequestMapping("/test/version1")
    @ResponseBody
    public String testversion(@RequestParam("id") int id) {
        String result = iVersionService.dubboCallProiderService(String.valueOf(id));
        return result;
    }

    @RequestMapping("/test/version2")
    @ResponseBody
    public String testversion2(@RequestParam("id") int id) {
        String result = iVersionService2.dubboCallProiderService(String.valueOf(id));
        return result;
    }
}
package org.example.impl;

import org.apache.dubbo.config.annotation.DubboService;
import org.example.api.IGroupService;
import org.example.api.ITestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;

@Component
@DubboService(interfaceClass = IGroupService.class,group = "group2")
public class Group2ServiceImpl implements IGroupService {
    @Autowired
    private Environment env;

    @Override
    public String dubboCallProiderService(String params) {
        return  env.getProperty("version")+"hello group2:"+" , " + params;
    }
}

package org.example.impl;

import org.apache.dubbo.config.annotation.DubboService;
import org.example.api.IGroupService;
import org.example.api.ITestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;

@Component
@DubboService(interfaceClass = IGroupService.class,group = "group1")
public class Group1ServiceImpl implements IGroupService {
    @Autowired
    private Environment env;

    @Override
    public String dubboCallProiderService(String params) {
        return  env.getProperty("version")+"hello group1:"+" , " + params;
    }
}
SEVERE: Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.apache.dubbo.rpc.RpcException: Failed to invoke the method dubboCallProiderService in the service org.example.api.IGroupService. Tried 3 times of the providers [dubbo-hello-provider:20880] (1/1) from the registry dubbo-hello-provider:20880 on the consumer 172.20.1.50 using the dubbo version 3.0.3. Last error is: Failed to invoke remote method: dubboCallProiderService, provider: dubbo://dubbo-hello-provider:20880/org.example.api.IGroupService?application=dubbo-demo-consumer&check=false&group=group2&interface=org.example.api.IGroupService&pid=1&qos.enable=false&register.ip=172.20.1.50&side=consumer&sticky=false, cause: org.apache.dubbo.remoting.RemotingException: 0] with root cause
org.apache.dubbo.remoting.RemotingException: 0
        at org.apache.dubbo.remoting.exchange.support.DefaultFuture.doReceived(DefaultFuture.java:207)
        at org.apache.dubbo.remoting.exchange.support.DefaultFuture.received(DefaultFuture.java:170)
        at org.apache.dubbo.remoting.exchange.support.DefaultFuture.received(DefaultFuture.java:158)
        at org.apache.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.handleResponse(HeaderExchangeHandler.java:60)
        at org.apache.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.received(HeaderExchangeHandler.java:181)
        at org.apache.dubbo.remoting.transport.DecodeHandler.received(DecodeHandler.java:51)
        at org.apache.dubbo.remoting.transport.dispatcher.ChannelEventRunnable.run(ChannelEventRunnable.java:57)
        at org.apache.dubbo.common.threadpool.ThreadlessExecutor$RunnableWrapper.run(ThreadlessExecutor.java:196)
        at org.apache.dubbo.common.threadpool.ThreadlessExecutor.waitAndDrain(ThreadlessExecutor.java:99)
        at org.apache.dubbo.rpc.AsyncRpcResult.get(AsyncRpcResult.java:179)
        at org.apache.dubbo.rpc.protocol.AbstractInvoker.waitForResultIfSync(AbstractInvoker.java:275)
        at org.apache.dubbo.rpc.protocol.AbstractInvoker.invoke(AbstractInvoker.java:182)
        at org.apache.dubbo.rpc.listener.ListenerInvokerWrapper.invoke(ListenerInvokerWrapper.java:78)
        at org.apache.dubbo.rpc.cluster.support.AbstractClusterInvoker.invokeWithContext(AbstractClusterInvoker.java:300)
        at org.apache.dubbo.rpc.cluster.support.FailoverClusterInvoker.doInvoke(FailoverClusterInvoker.java:79)
        at org.apache.dubbo.rpc.cluster.support.AbstractClusterInvoker.invoke(AbstractClusterInvoker.java:268)
        at org.apache.dubbo.monitor.support.MonitorFilter.invoke(MonitorFilter.java:89)
        at org.apache.dubbo.rpc.cluster.filter.FilterChainBuilder$FilterChainNode.invoke(FilterChainBuilder.java:84)
        at org.apache.dubbo.rpc.protocol.dubbo.filter.FutureFilter.invoke(FutureFilter.java:51)
        at org.apache.dubbo.rpc.cluster.filter.FilterChainBuilder$FilterChainNode.invoke(FilterChainBuilder.java:84)
        at org.apache.dubbo.rpc.cluster.filter.support.ConsumerContextFilter.invoke(ConsumerContextFilter.java:108)
        at org.apache.dubbo.rpc.cluster.filter.FilterChainBuilder$FilterChainNode.invoke(FilterChainBuilder.java:84)
        at org.apache.dubbo.rpc.cluster.support.wrapper.AbstractCluster$ClusterFilterInvoker.invoke(AbstractCluster.java:92)
        at org.apache.dubbo.rpc.cluster.support.wrapper.MockClusterInvoker.invoke(MockClusterInvoker.java:94)
        at org.apache.dubbo.rpc.proxy.InvokerInvocationHandler.invoke(InvokerInvocationHandler.java:92)
        at org.apache.dubbo.common.bytecode.proxy1.dubboCallProiderService(proxy1.java)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:208)
        at com.sun.proxy.$Proxy60.dubboCallProiderService(Unknown Source)
        at org.example.DubboconsumerApplication.testgroup2(DubboconsumerApplication.java:56)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:197)
        at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:141)
        at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:106)
        at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895)
        at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:808)
        at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
        at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1064)
        at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:963)
        at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)
        at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:655)
        at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:764)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:228)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:163)
        at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:190)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:163)
        at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:190)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:163)
        at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:190)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:163)
        at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:190)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:163)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)
        at org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:769)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:357)
        at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:382)
        at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
        at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:893)
        at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1723)
        at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
        at java.lang.Thread.run(Thread.java:745)

Note: The Envoy_collect tool gathers a tarball with debug logs, config and the following admin endpoints: /stats, /clusters and /server_info. Please note if there are privacy concerns, sanitize the data prior to sharing the tarball/pasting.

Admin and Stats Output:

Include the admin output for the following endpoints: /stats, /clusters, /routes, /server_info. For more information, refer to the admin endpoint documentation.

Note: If there are privacy concerns, sanitize the data prior to sharing.

Config:

Include the config used to configure Envoy.

Logs:

Include the access logs and the Envoy logs.

Note: If there are privacy concerns, sanitize the data prior to sharing.

Call Stack:

If the Envoy binary is crashing, a call stack is required. Please refer to the Bazel Stack trace documentation.

daixiang0 commented 2 years ago

/cc @wbpcode

wbpcode commented 2 years ago

Could you also provide the log of sidecar proxy (envoy)? You can enable the debug log for dubbo proxy by call curl localhost:15000/logging?dubbo=debug -X POST in the proxy container.

13567436138 commented 2 years ago
2022-07-07T03:47:03.640918Z     debug   envoy dubbo     dubbo decoder: 270 bytes available
2022-07-07T03:47:03.640935Z     debug   envoy dubbo     dubbo decoder: protocol dubbo, state OnDecodeStreamHeader, 270 bytes available
2022-07-07T03:47:03.640938Z     debug   envoy dubbo     dubbo: create the new decoder event handler
2022-07-07T03:47:03.640966Z     debug   envoy dubbo     dubbo route matcher: interface matching failed
2022-07-07T03:47:03.640968Z     debug   envoy dubbo     dubbo route matcher: interface matching failed
2022-07-07T03:47:03.640969Z     debug   envoy dubbo     dubbo route matcher: interface matching failed
2022-07-07T03:47:03.640969Z     debug   envoy dubbo     dubbo route matcher: interface matching failed
2022-07-07T03:47:03.640970Z     debug   envoy dubbo     dubbo route matcher: interface matching failed
2022-07-07T03:47:03.640972Z     debug   envoy dubbo     [C505][S7431156288318709142] dubbo router: no cluster match for interface 'org.example.api.IGroupService'
2022-07-07T03:47:03.640975Z     debug   envoy dubbo     Exception information: dubbo router: no route for interface 'org.example.api.IGroupService'
2022-07-07T03:47:03.640983Z     debug   envoy dubbo     dubbo request: complete processing of downstream request messages, id is 22
2022-07-07T03:47:03.640984Z     debug   envoy dubbo     dubbo decoder: ends the deserialization of the message
2022-07-07T03:47:03.640985Z     debug   envoy dubbo     dubbo decoder: data length 0
2022-07-07T03:47:03.640988Z     debug   envoy dubbo     destroy decoder filter
2022-07-07T03:47:03.642547Z     debug   envoy dubbo     dubbo decoder: 270 bytes available
2022-07-07T03:47:03.642556Z     debug   envoy dubbo     dubbo decoder: protocol dubbo, state OnDecodeStreamHeader, 270 bytes available
2022-07-07T03:47:03.642558Z     debug   envoy dubbo     dubbo: create the new decoder event handler
2022-07-07T03:47:03.642574Z     debug   envoy dubbo     dubbo route matcher: interface matching failed
2022-07-07T03:47:03.642575Z     debug   envoy dubbo     dubbo route matcher: interface matching failed
2022-07-07T03:47:03.642576Z     debug   envoy dubbo     dubbo route matcher: interface matching failed
2022-07-07T03:47:03.642577Z     debug   envoy dubbo     dubbo route matcher: interface matching failed
2022-07-07T03:47:03.642578Z     debug   envoy dubbo     dubbo route matcher: interface matching failed
2022-07-07T03:47:03.642579Z     debug   envoy dubbo     [C505][S289615493213678275] dubbo router: no cluster match for interface 'org.example.api.IGroupService'
2022-07-07T03:47:03.642581Z     debug   envoy dubbo     Exception information: dubbo router: no route for interface 'org.example.api.IGroupService'
2022-07-07T03:47:03.642587Z     debug   envoy dubbo     dubbo request: complete processing of downstream request messages, id is 23
2022-07-07T03:47:03.642588Z     debug   envoy dubbo     dubbo decoder: ends the deserialization of the message
2022-07-07T03:47:03.642589Z     debug   envoy dubbo     dubbo decoder: data length 0
2022-07-07T03:47:03.642590Z     debug   envoy dubbo     destroy decoder filter
2022-07-07T03:47:03.658338Z     debug   envoy dubbo     dubbo decoder: 270 bytes available
2022-07-07T03:47:03.658355Z     debug   envoy dubbo     dubbo decoder: protocol dubbo, state OnDecodeStreamHeader, 270 bytes available
2022-07-07T03:47:03.658358Z     debug   envoy dubbo     dubbo: create the new decoder event handler
2022-07-07T03:47:03.658384Z     debug   envoy dubbo     dubbo route matcher: interface matching failed
2022-07-07T03:47:03.658386Z     debug   envoy dubbo     dubbo route matcher: interface matching failed
2022-07-07T03:47:03.658387Z     debug   envoy dubbo     dubbo route matcher: interface matching failed
2022-07-07T03:47:03.658388Z     debug   envoy dubbo     dubbo route matcher: interface matching failed
2022-07-07T03:47:03.658389Z     debug   envoy dubbo     dubbo route matcher: interface matching failed
2022-07-07T03:47:03.658391Z     debug   envoy dubbo     [C505][S1670597019862712948] dubbo router: no cluster match for interface 'org.example.api.IGroupService'
2022-07-07T03:47:03.658393Z     debug   envoy dubbo     Exception information: dubbo router: no route for interface 'org.example.api.IGroupService'
2022-07-07T03:47:03.658403Z     debug   envoy dubbo     dubbo request: complete processing of downstream request messages, id is 24
2022-07-07T03:47:03.658404Z     debug   envoy dubbo     dubbo decoder: ends the deserialization of the message
2022-07-07T03:47:03.658405Z     debug   envoy dubbo     dubbo decoder: data length 0
2022-07-07T03:47:03.658407Z     debug   envoy dubbo     destroy decoder filter
[2022-07-07T03:47:03.633Z] "GET /test/group1?id=1 HTTP/1.1" 500 - via_upstream - "-" 0 287 46 46 "172.20.0.0" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.82 Safari/537.36" "cf2fd7e8-f009-436d-bc54-23d061e464e9" "192.168.229.128:30555" "172.20.1.69:8081" inbound|8081|| 127.0.0.6:53477 172.20.1.69:8081 172.20.0.0:0 outbound_.8081_._.dubbo-hello-consumer.istio.svc.cluster.local default
github-actions[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in the next 7 days unless it is tagged "help wanted" or "no stalebot" or other activity occurs. Thank you for your contributions.

github-actions[bot] commented 2 years ago

This issue has been automatically closed because it has not had activity in the last 37 days. If this issue is still valid, please ping a maintainer and ask them to label it as "help wanted" or "no stalebot". Thank you for your contributions.