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

Zookeeper node sessionTimeout in provider side #12485

Closed
niguibin opened this issue Jun 9, 2023 · 2 comments · Fixed by #14903
Closed

Zookeeper node sessionTimeout in provider side #12485

niguibin opened this issue Jun 9, 2023 · 2 comments · Fixed by #14903
Labels
component/sdk Related with apache/dubbo help wanted Everything needs help from contributors type/enhancement Everything related with code enhancement or performance

Comments

@niguibin
Copy link

niguibin commented Jun 9, 2023

请问 CuratorFrameworkUtils 这个类的 buildCuratorFramework 方法中创建 CuratorFramework 时为什么没有执行 builder.sessionTimeoutMs(connectionURL.getParameter(SESSION_KEY, DEFAULT_SESSION_TIMEOUT_MS)) 方法,不能自己设置 sessionTimeout 呢

public class ZookeeperServiceDiscovery extends AbstractServiceDiscovery {
    // ......
  
    public ZookeeperServiceDiscovery(ApplicationModel applicationModel, URL registryURL) {
        super(applicationModel, registryURL);
        try {
            this.curatorFramework = buildCuratorFramework(registryURL, this);
            // ......
        } catch (Exception e) {
            throw new IllegalStateException("Create zookeeper service discovery failed.", e);
        }
    }

    public static CuratorFramework buildCuratorFramework(URL connectionURL, ZookeeperServiceDiscovery serviceDiscovery) throws Exception {
        CuratorFrameworkFactory.Builder builder = CuratorFrameworkFactory.builder()
            .connectString(connectionURL.getBackupAddress())
            .retryPolicy(buildRetryPolicy(connectionURL));
        String userInformation = connectionURL.getUserInformation();
        if (StringUtils.isNotEmpty(userInformation)) {
            builder = builder.authorization("digest", userInformation.getBytes());
            builder.aclProvider(new ACLProvider() {
                @Override
                public List<ACL> getDefaultAcl() {
                    return ZooDefs.Ids.CREATOR_ALL_ACL;
                }

                @Override
                public List<ACL> getAclForPath(String path) {
                    return ZooDefs.Ids.CREATOR_ALL_ACL;
                }
            });
        }
        CuratorFramework curatorFramework = builder.build();
        // ......
        return curatorFramework;
    }
   // ......

作为 provider,当该 provider 下线之后,/services/xxx 节点仍然存在,等到默认 60s 之后才会删除,这期间当consumer 端请求该 provider 时就会报如下错误

org.apache.dubbo.rpc.StatusRpcException: DEADLINE_EXCEEDED : Waiting server-side response timeout by scan timer. start time: 2023-06-09 17:00:09.431, end time: 2023-06-09 17:00:12.447, timeout: 3000 ms, service: xxx.xxx.xxx

现在想改短一点 sessionTimeout 就只能修改 zookeeper 配置中的 maxSessionTimeout 或 tickTime 了吗

@AlbumenJ
Copy link
Member

May fixed in #9317

@niguibin
Copy link
Author

May fixed in

这个 #9317 中的 CuratorZookeeperClient 应该是控制 /dubbo/xxx.xxx/providers 节点的,而 ZookeeperServiceDiscovery 中的 CuratorFramework 是控制 /services/xxx 节点的,这是两个客户端,我很疑惑,为什么在 CuratorZookeeperClient 中是设置了 sessiontimeout 的,在 ZookeeperServiceDiscovery 中没有设置 sessiontimeout。但是 consumer 端是只有在 /dubbo/xxx.xxx.providers/ 节点和 /services/xxx 节点都不存在时才认为该 provider 不存在了,所以这两个节点的 sessiontimeout 应该要保持一致才对

@AlbumenJ AlbumenJ added help wanted Everything needs help from contributors type/enhancement Everything related with code enhancement or performance component/sdk Related with apache/dubbo and removed question labels Mar 8, 2024
@AlbumenJ AlbumenJ changed the title 关于 provider 的 sessionTimeout Zookeeper node sessionTimeout in provider side Mar 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/sdk Related with apache/dubbo help wanted Everything needs help from contributors type/enhancement Everything related with code enhancement or performance
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants