spring-cloud / spring-cloud/spring-cloud-zookeeper

ZookeeperPropertySourceLocator not synchronized with ConfigWatcher

Open
#289 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

waiting-for-triage
Dominant language
Java
Stars
574
Forks
408
Avg merge
1d 12h
Merged PRs (30d)
4

Description

Describe the bug
Locating propertySources in ZookeeperPropertySourceLocator by directly accessing zookeeper instead of ConfigWatcher and its' TreeCaches can lead to several serious problems.

  1. Zookeeper new changes lost when ZookeeperPropertySourceLocator locating.
  2. Curator framework TreeCache events in ConfigWatcher lost before publishing ApplicationReadyEvent.
  3. Curator framework TreeCache NODE_ADDED events(normal TreeCache filling) interfere with the whole application after spring boot publishing ApplicationReadyEvent. Actually during curator framework TreeCache filling, the TreeCache NODE_ADDED events shoudn't cause RefreshEvent before TreeCache INITIALIZED event.
  4. TreeCache NODE_ADDED events(normal TreeCache filling) seriously interfere with the application from TreeCache event CONNECTION_LOST to CONNECTION_RECONNECTED.

This issue exists in spring-cloud-zookeeper 2.2.+, 3.+.

Sample
This issue is obvious by restarting spring boot application about ten times.
eg.

public class App {
  public static void main(String[] args) throw Exception {
    ConfigurableApplicationContext ctx;
    while(true) {
      ctx = SpringApplication.run(App.class, args);
      Thread.sleep(20000);
      ctx.close();
    }
  }
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with ZookeeperPropertySourceLocator and ConfigWatcher, then trace how their TreeCaches and events interact around ApplicationReadyEvent, connection loss, and reconnection. Reproduce the restart loop from the issue and inspect event ordering. Done means changes and relevant TreeCache events are not lost, and NODE_ADDED events do not trigger inappropriate refreshes during initialization or reconnection.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend, distributed-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.