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

[Bug] [Master] Potential danger in the event of a worker failover #15688

Closed
3 tasks done
ZhongJinHacker opened this issue Mar 10, 2024 · 0 comments · Fixed by #15689
Closed
3 tasks done

[Bug] [Master] Potential danger in the event of a worker failover #15688

ZhongJinHacker opened this issue Mar 10, 2024 · 0 comments · Fixed by #15689
Assignees
Labels
backend bug Something isn't working

Comments

@ZhongJinHacker
Copy link
Contributor

Search before asking

  • I had searched in the issues and found no similar issues.

What happened

    public void removeWorkerNodePath(String path, RegistryNodeType nodeType, boolean failover) {
        log.info("{} node deleted : {}", nodeType, path);
        try {
            String serverHost = null;
            if (!StringUtils.isEmpty(path)) {
                serverHost = registryClient.getHostByEventDataPath(path);
                if (StringUtils.isEmpty(serverHost)) {
                    log.error("server down error: unknown path: {}", path);
                    return;
                }
                if (!registryClient.exists(path)) {
                    log.info("path: {} not exists", path);
                }
            }
            // failover server
            if (failover) {
                failoverService.failoverServerWhenDown(serverHost, nodeType);
            }
        } catch (Exception e) {
            log.error("{} server failover failed", nodeType, e);
        }
    }

When call removeWorkerNodePath , if its first param named path is null, it will cause serverHost is null.
And it is unacceptable when call failoverService.failoverServerWhenDown, because in failoverServerWhenDown method block , masterFailoverService.failoverMaster and workerFailoverService.failoverWorker had already been emphasized that serverHost cannot be NULL by adding NonNull annotations

What you expected to happen

please assign this issue to me, I'm glad to deal with this issue

How to reproduce

make the situation of the path is null or empty string, and call removeWorkerNodePath, it will happen.

Anything else

No response

Version

dev

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants