Skip to content

Commit

Permalink
Fix another potential race in the file settings watcher (#90302)
Browse files Browse the repository at this point in the history
Fix another potential race in the file settings watcher for issue #89500
  • Loading branch information
thecoop authored Sep 23, 2022
1 parent d507a49 commit b76b968
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions docs/changelog/90302.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pr: 90302
summary: Fix another potential race in the file settings watcher
area: Infra/Core
type: bug
issues: [89500]
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,7 @@ synchronized void stopWatcher() {
logger.debug("stopping watcher ...");
if (watching()) {
try {
// make sure the watcher thread hits the processing latch correctly
cleanupWatchKeys();
fileUpdateState = null;
watchService.close();
Expand All @@ -350,6 +351,8 @@ synchronized void stopWatcher() {
if (watcherThreadLatch != null) {
watcherThreadLatch.await();
}
// the watcher thread might have snuck in behind us and re-created the settings watch again
cleanupWatchKeys();
} catch (IOException e) {
logger.warn("encountered exception while closing watch service", e);
} catch (InterruptedException interruptedException) {
Expand Down

0 comments on commit b76b968

Please sign in to comment.