Dubbo: upgrade to 2.7.6 version, consumer is abnormal

Created on 8 Apr 2020  ·  3Comments  ·  Source: apache/dubbo

Environment

  • Dubbo version: 2.7.6
  • Operating System version: mac os 10.15.4
  • Java version: java 8

Steps to reproduce this issue

1.upgrade from 2.7.4.1 to 2.7.6 version
2.consumer other exported service
3.occur No provider available from registry ... for service ... use dubbo version 2.7.6, please check status of providers(disabled, not registered or in blacklist).

  • I trace the souce code and found URL.getParameter has changed.

  • 2.7.4.1 version source code of URL class is

public String getParameter(String key) { String value = parameters.get(key); return StringUtils.isEmpty(value) ? parameters.get(DEFAULT_KEY_PREFIX + key) : value; }

  • but 2.7.6 is change to

public String getParameter(String key) { return parameters.get(key); }

  • because my provider service is old project, provider group has prefix default, so will not match when consumer.

  • I don't know why do this change, force users to upgrade or other solutions?

  • Sincerely thank you for your reply!

  • If there is an exception, please attach the exception trace:

at org.apache.dubbo.registry.integration.RegistryDirectory.doList(RegistryDirectory.java:599)
    at org.apache.dubbo.rpc.cluster.directory.AbstractDirectory.list(AbstractDirectory.java:75)
    at org.apache.dubbo.rpc.cluster.support.AbstractClusterInvoker.list(AbstractClusterInvoker.java:291)
    at org.apache.dubbo.rpc.cluster.support.AbstractClusterInvoker.invoke(AbstractClusterInvoker.java:256)
    at org.apache.dubbo.rpc.cluster.interceptor.ClusterInterceptor.intercept(ClusterInterceptor.java:47)
    at org.apache.dubbo.rpc.cluster.support.wrapper.AbstractCluster$InterceptorInvokerNode.invoke(AbstractCluster.java:92)
    at org.apache.dubbo.rpc.cluster.support.wrapper.MockClusterInvoker.invoke(MockClusterInvoker.java:82)
    at org.apache.dubbo.rpc.proxy.InvokerInvocationHandler.invoke(InvokerInvocationHandler.java:74)
    at org.apache.dubbo.common.bytecode.proxy0.getTaskRejudgeRecord(proxy0.java)
    at com.huitongjy.exambase.invoke.ExamSystemInvoker.getTaskRejudgeRecord(ExamSystemInvoker.java:75)
    at com.huitongjy.exambase.invoke.ExamSystemInvoker$$FastClassBySpringCGLIB$$c6109738.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
    at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:771)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
    at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:749)
    at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:95)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
    at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:749)
    at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:691)
    at com.huitongjy.exambase.invoke.ExamSystemInvoker$$EnhancerBySpringCGLIB$$a5e29bf6.getTaskRejudgeRecord(<generated>)
    at com.huitongjy.exambase.support.polling.business.rejudge.TaskRejudgeExecutor.call(TaskRejudgeExecutor.java:46)
    ... 8 common frames omitted

All 3 comments

If you use nacos as register this problem may has been sloved by #5902 . And it would be fix in 2.7.7 version or you can checkout the newest version of master branch and install it in your computer.

Also you can check the issue #5885 whether it the same with yours.

2.7.7 may also not work!

I see 2.7.7 version modify URL#valueOf method for compatible low version, but low version service will not invoke the new version URL#valueOf method, result in-store registry center URL only has default.name, but when the consumer pulls provider URL from registry center, this URL will invoke URLStrParser#parseURLBody, so this URL has not group name, only has default.group.

public static URL valueOf(String url) { if (url == null || (url = url.trim()).length() == 0) { throw new IllegalArgumentException("url == null"); } String protocol = null; String username = null; String password = null; String host = null; int port = 0; String path = null; Map<String, String> parameters = null; int i = url.indexOf('?'); // separator between body and parameters if (i >= 0) { String[] parts = url.substring(i + 1).split("&"); parameters = new HashMap<>(); for (String part : parts) { part = part.trim(); if (part.length() > 0) { int j = part.indexOf('='); if (j >= 0) { String key = part.substring(0, j); String value = part.substring(j + 1); parameters.put(key, value); // compatible with lower versions registering "default." keys if (key.startsWith(DEFAULT_KEY_PREFIX)) { parameters.putIfAbsent(key.substring(DEFAULT_KEY_PREFIX.length()), value); } } else { parameters.put(part, part); } } } url = url.substring(0, i); } ...

Was this page helpful?
0 / 5 - 0 ratings