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容错模式下,设置重试次数为0,依旧会重试一次 #8715

Closed
2 tasks done
changfubai opened this issue Sep 7, 2021 · 5 comments
Closed
2 tasks done

Comments

@changfubai
Copy link
Contributor

  • I have searched the issues of this repository and believe that this is not a duplicate.
  • I have checked the FAQ of this repository and believe that this is not a duplicate.

Environment

  • Dubbo version: 2.7/3.0
  • Operating System version: ==
  • Java version: 1.8

Steps to reproduce this issue

review代码时发现failback模式下的retries判断有问题。

image
调用失败时,没有判断重试次数,就直接加到了timer中。
image

timer中执行时,如果抛出异常,才判断如果超过重试次数,不继续进行。
image

Pls. provide [GitHub address] to reproduce this issue.

Expected Result

加到timer中之前就需要判断一次retries

Actual Result

What actually happens?

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

Just put your stack trace here!
@changfubai
Copy link
Contributor Author

I'll fix it later.

@283883031
Copy link

283883031 commented Jan 4, 2022

 public FailbackClusterInvoker(Directory<T> directory) {
        super(directory);

        int retriesConfig = getUrl().getParameter(RETRIES_KEY, DEFAULT_FAILBACK_TIMES);
        if (retriesConfig <= 0) {
            retriesConfig = DEFAULT_FAILBACK_TIMES;
        }
        int failbackTasksConfig = getUrl().getParameter(FAIL_BACK_TASKS_KEY, DEFAULT_FAILBACK_TASKS);
        if (failbackTasksConfig <= 0) {
            failbackTasksConfig = DEFAULT_FAILBACK_TASKS;
        }
        retries = retriesConfig;
        failbackTasks = failbackTasksConfig;
    }

set retries is zero ,finaly it's default? 改了,最后还是没改?

@changfubai
Copy link
Contributor Author

 public FailbackClusterInvoker(Directory<T> directory) {
        super(directory);

        int retriesConfig = getUrl().getParameter(RETRIES_KEY, DEFAULT_FAILBACK_TIMES);
        if (retriesConfig <= 0) {
            retriesConfig = DEFAULT_FAILBACK_TIMES;
        }
        int failbackTasksConfig = getUrl().getParameter(FAIL_BACK_TASKS_KEY, DEFAULT_FAILBACK_TASKS);
        if (failbackTasksConfig <= 0) {
            failbackTasksConfig = DEFAULT_FAILBACK_TASKS;
        }
        retries = retriesConfig;
        failbackTasks = failbackTasksConfig;
    }

set retries is zero ,finaly it's default? 改了,最后还是没改?

这是构造方法的逻辑呀,我改的是run方法里的逻辑,显然不会又设置为DEFAULT_FAILBACK_TIMES呀

@changfubai changfubai changed the title failback负载模式下,设置重试次数为0,依旧会重试一次 failback容错模式下,设置重试次数为0,依旧会重试一次 Jan 24, 2022
@juzi214032
Copy link
Contributor

 public FailbackClusterInvoker(Directory<T> directory) {
        super(directory);

        int retriesConfig = getUrl().getParameter(RETRIES_KEY, DEFAULT_FAILBACK_TIMES);
        if (retriesConfig <= 0) {
            retriesConfig = DEFAULT_FAILBACK_TIMES;
        }
        int failbackTasksConfig = getUrl().getParameter(FAIL_BACK_TASKS_KEY, DEFAULT_FAILBACK_TASKS);
        if (failbackTasksConfig <= 0) {
            failbackTasksConfig = DEFAULT_FAILBACK_TASKS;
        }
        retries = retriesConfig;
        failbackTasks = failbackTasksConfig;
    }

set retries is zero ,finaly it's default? 改了,最后还是没改?

see #9526

@283883031
Copy link

ok

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