spring-cloud / spring-cloud/spring-cloud-zookeeper
ZookeeperPropertySourceLocator not synchronized with ConfigWatcher
Nobody has claimed this yet.
- 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.
- Zookeeper new changes lost when ZookeeperPropertySourceLocator locating.
- Curator framework TreeCache events in ConfigWatcher lost before publishing ApplicationReadyEvent.
- 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.
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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