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

设置retries 为0,测试后还是consumer还是继续重试。 #9522

Closed
283883031 opened this issue Jan 4, 2022 · 7 comments
Closed

设置retries 为0,测试后还是consumer还是继续重试。 #9522

283883031 opened this issue Jan 4, 2022 · 7 comments
Assignees
Labels
type/bug Bugs to being fixed

Comments

@283883031
Copy link

283883031 commented Jan 4, 2022

Environment

  • Dubbo version: 2.7.14
  • Operating System version: win10
  • Java version: jdk1.8

Steps to reproduce this issue

  1. <dubbo:consumer check="false" retries="0"/>
  2. 服务端抛出异常。
  3. 消费者继续请求

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

Expected Behavior

retries设置为0后,服务端抛出异常,消费端不继续请求

Actual Behavior

retries设置为0后,服务端抛出异常,消费端仍然继续请求

review code:dubbo:2.7.14, 2.7.15

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;
    }

如果小于0,则设置为默认值?

@283883031 283883031 added the type/bug Bugs to being fixed label Jan 4, 2022
@juzi214032
Copy link
Contributor

没问题了吗

@283883031
Copy link
Author

283883031 commented Jan 4, 2022 via email

@juzi214032
Copy link
Contributor

刚刚重试了,又没有复现了。  Give you best wishes from your friends Mr.Jz!  

我试了一下,确实是有问题的,当 retries 设置为 0 时,会被错误的重置为 3,导致依然会重试,这个我提个 pr 修复一下,你可以把 issue 重新打开一下

@juzi214032
Copy link
Contributor

@CrazyHZM I will try to reproduce the whole problem, please assign him to me

@283883031
Copy link
Author

上次复现我记得是因为超时了,但是今天我还没复现出这个BUG。

@juzi214032
Copy link
Contributor

上次复现我记得是因为超时了,但是今天我还没复现出这个BUG。

在 provider 中 Thread.sleep() 一下很容易复现

juzi214032 added a commit to juzi214032/dubbo that referenced this issue Jan 4, 2022
When the retries value is zero,
the logic in failback mode resets it to the default value of 3,
making it impossible to turn off the retry mechanism.

Fixes apache#9522
juzi214032 added a commit to juzi214032/dubbo that referenced this issue Jan 4, 2022
When the retries value is zero,
the logic in failback mode resets it to the default value of 3,
making it impossible to turn off the retry mechanism.

Fixes apache#9522
juzi214032 added a commit to juzi214032/dubbo that referenced this issue Jan 4, 2022
When the retries value is zero,
the logic in failback mode resets it to the default value of 3,
making it impossible to turn off the retry mechanism.

Fixes apache#9522
@codeimport
Copy link
Contributor

failback模式下有问题,failover模式没问题。

AlbumenJ pushed a commit that referenced this issue Jan 23, 2022
When the retries value is zero,
the logic in failback mode resets it to the default value of 3,
making it impossible to turn off the retry mechanism.

Fixes #9522
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug Bugs to being fixed
Projects
None yet
Development

No branches or pull requests

3 participants