spring-cloud-zookeeper icon indicating copy to clipboard operation
spring-cloud-zookeeper copied to clipboard

ZookeeperPropertySourceLocator not synchronized with ConfigWatcher

Open forchid opened this issue 4 years ago • 0 comments

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

forchid avatar Jun 12 '21 04:06 forchid