Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix another potential race in the file settings watcher (#90302) #90388

Merged
merged 1 commit into from
Sep 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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