From eb358eeb350c66b39daf6b2838dc0aceab2978ba Mon Sep 17 00:00:00 2001 From: wangchengming <634749869@qq.com> Date: Mon, 6 Dec 2021 11:47:59 +0800 Subject: [PATCH] fix #9341, ignore OverlappingFileLockException --- .../apache/dubbo/registry/support/AbstractRegistry.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/support/AbstractRegistry.java b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/support/AbstractRegistry.java index 4c71d8369e7..05e2c3420e5 100644 --- a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/support/AbstractRegistry.java +++ b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/support/AbstractRegistry.java @@ -36,6 +36,7 @@ import java.io.RandomAccessFile; import java.nio.channels.FileChannel; import java.nio.channels.FileLock; +import java.nio.channels.OverlappingFileLockException; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -203,7 +204,11 @@ public void doSaveProperties(long version) { } catch (Throwable e) { savePropertiesRetryTimes.incrementAndGet(); if (savePropertiesRetryTimes.get() >= MAX_RETRY_TIMES_SAVE_PROPERTIES) { - logger.warn("Failed to save registry cache file after retrying " + MAX_RETRY_TIMES_SAVE_PROPERTIES + " times, cause: " + e.getMessage(), e); + if (e instanceof OverlappingFileLockException) { + // fix #9341, ignore OverlappingFileLockException + } else { + logger.warn("Failed to save registry cache file after retrying " + MAX_RETRY_TIMES_SAVE_PROPERTIES + " times, cause: " + e.getMessage(), e); + } savePropertiesRetryTimes.set(0); return; }