Skip to content

并发注册同一集群bug #8283

@qiugongzi

Description

@qiugongzi

Describe the bug
当多个线程同时向同一服务注册同一集群时,该集群会执行多个健康检查任务。com.alibaba.nacos.naming.core.Cluster类代码
image
很明显,该init方法不是原子操作,存在多个线程同时读取inited变量为false的情况,则会将同一健康检查任务执行多次。

Expected behavior
同一集群实例,只应该初始化一次

Acutally behavior
同一集群实例,可能初始化多次

How to Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Desktop (please complete the following information):

  • OS: [e.g. Centos]
  • Version [e.g. nacos-server 1.3.1, nacos-client 1.3.1]
  • Module [e.g. naming/config]
  • SDK [e.g. original, spring-cloud-alibaba-nacos, dubbo]

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions