Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

★★★★★★我又来了!failback出现执行次数不固定的bug!!!!!! #8718

Closed
startjava opened this issue Sep 8, 2021 · 6 comments

Comments

@startjava
Copy link

说一下基本情况。

服务提供者:

public class HelloService4 implements IService4 {
    @Value("${server.port}")
    private int portValue;

    @Override
    public String getHello(String username) {
        System.out.println("HelloService4 portValue=" + portValue + " username=" + username);
        return "hello4 " + username + " port=" + portValue;
    }
}

服务消费者:

    @RequestMapping("Test4")
    public void test4(HttpServletRequest request, HttpServletResponse response) {
        for (int i = 0; i < 3000; i++) {
            String helloString = service4.getHello("中国人4-" + (i + 1));
            System.out.println("public String test4() " + helloString + " i=" + (i + 1));
            Thread.yield();
        }
    }

注意:服务消费者使用failback!服务消费者使用failback!服务消费者使用failback!服务消费者使用failback!

正常的操作过程:
(1)启动3个服务提供者
(2)启动1个服务消费者
(3)执行服务消费者的Controller调用服务提供者
(4)在服务消费者的控制台输出的结果中使用工具明确确定执行了3000次,不多不少。

问题来了!

(1)停止所有服务提供者进程
(2)执行服务消费者的Controller调用服务提供者,在内部会走定时器队列,因为调用超时了。
(3)启动1个服务提供者,这时控制台出现异常:
新建文本文档 (4).txt
(4)查询“HelloService4 portValue=8086 username=中国人4-”字符串,查询出3002个。

多出2个!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!有的时候还会是2993或2997,不是多就是少,有的时候是3000,但机会很少!!!!!!!

我猜测当服务提供者启动时出现的那几个异常导致的。

这肯定是一个bug

@startjava
Copy link
Author

发现一个现象:
重试的执行次数是txt中最先开始的:
HelloService4 portValue=8086 username=中国人4-3
HelloService4 portValue=8086 username=中国人4-6

以及txt最后打印:
HelloService4 portValue=8086 username=中国人4-6
HelloService4 portValue=8086 username=中国人4-3

这就是为什么出现3002次,所以我怀疑是不是服务提供者在启动的过程中由于内部还没有准确好,则服务消费者就认为服务提供者准确好了,开始调用,导致调用失败,进行重试,当然这只是我的猜测。

还请DUBBO大佬分析一下。

@zrlw
Copy link
Contributor

zrlw commented Sep 8, 2021

  1. retry默认值是2,设置为0依然retry一次是个bug,看到社区已提交了pr;
  2. 通知服务消费者服务方已就绪的职责是注册中心。

@startjava
Copy link
Author

startjava commented Sep 8, 2021 via email

@zrlw
Copy link
Contributor

zrlw commented Sep 8, 2021

如果有retry,日志里会有明确提示的。前提是日志能看到有dubbo的类名记录,如果日志里看不到,要改pom文件,让应用和dubbo使用相同的日志框架。

@icankeep
Copy link
Contributor

icankeep commented Sep 13, 2021

solved: #8719

@icankeep
Copy link
Contributor

&READY_TO_CLOSE&

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants