You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2022/01/07 03:30:02 UTC

[GitHub] [dubbo] BurningCN commented on pull request #9518: Delete the lock file after metadata store completion

BurningCN commented on pull request #9518:
URL: https://github.com/apache/dubbo/pull/9518#issuecomment-1007113189


   > In dubbo 3.0.5 version, a warn log will appear when starting the project
   > 
   > ```java
   > 2022-01-06 00:42:36.564  WARN 22628 o.a.d.r.zookeeper.ZookeeperRegistry      :  [DUBBO] Failed to save registry cache file, will retry, cause: null, dubbo version: 3.0.5, current host: 10.18.0.3
   > 
   > java.nio.channels.OverlappingFileLockException: null
   > 	at sun.nio.ch.SharedFileLockTable.checkList(FileLockTable.java:255)
   > 	at sun.nio.ch.SharedFileLockTable.add(FileLockTable.java:152)
   > 	at sun.nio.ch.FileChannelImpl.tryLock(FileChannelImpl.java:1107)
   > 	at java.nio.channels.FileChannel.tryLock(FileChannel.java:1155)
   > 	at org.apache.dubbo.registry.support.AbstractRegistry.doSaveProperties(AbstractRegistry.java:187)
   > 	at org.apache.dubbo.registry.support.AbstractRegistry$SaveProperties.run(AbstractRegistry.java:555)
   > 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
   > 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
   > 	at java.lang.Thread.run(Thread.java:748)
   > ```
   > 
   > I didn’t look into the code in depth it looks like it’s caused by repeated locks, and I found that the latest master branch [code](https://github.com/apache/dubbo/blob/4cc3b28a3e7e76ce18bb0a6d0fd288ab07dae99a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/support/AbstractRegistry.java#L182) has been fixed. I also saw the same logic in `AbstractMetadataReport`, so I thought it might be a potential problem, so I submitted pr
   > 
   > see also this(#9358)
   
   You can look at the `FileCacheStore` of the latest 3.0 code. This file lock will not be released every time it is used up, but will be released when the `FileCacheStore#destroy` method is finally called. You can also refer to the handling of `OverlappingFileLockException` in `FileCacheStore` .
   
   In addition, this exception occurs when two application cache files opened on a machine have the same name, which leads to tryLock on the same file, which triggers this exception. For example, the following two test cases will trigger
   
   ![image](https://user-images.githubusercontent.com/43363120/148486384-4dbbc93f-4aae-4619-bc8d-5e69e4b646f6.png)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org