Skip to content

Commit

Permalink
Fix another potential race in the file settings watcher (#90388)
Browse files Browse the repository at this point in the history
Fix another potential race in the file settings watcher for issue #89500
This backports #90302
  • Loading branch information
thecoop committed Sep 27, 2022
1 parent e913f6c commit 5f55955
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 @@ -345,6 +345,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 @@ -354,6 +355,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 5f55955

Please sign in to comment.