The Dubbo service started with an error, the exception information is as follows:
2016-08-22 16:44:40.588 | dubbosaveregistrycache-thread-1 | WARN | Com.alibaba.dubbo.common.logger.log4j.Log4jLogger:Log4jLogger.java (78) | [Dubbo] Failed to save registry store file, Cause:can not lock the registry cache file/root/.dubbo/dubbo-registry-10.141.4.168.c Ache, ignore and retry later, maybe multi Java process use the file, please config:dubbo.registry.file=xxx.properties, du Bbo version:2.8.3, current host:127.0.0.1 Java.io.IOException:Can not lock the registry cache File/root/.dubbo/dubbo-r Egistry-10.141.4.168.cache, ignore and retry later, maybe multi Java process use the file, please CONFIG:DUBBO.REGISTRY.F Ile=xxx.properties at Com.alibaba.dubbo.registry.support.AbstractRegistry.doSaveProperties (Abstractregistry.java : 193) ~[dubbo-2.8.3.jar:2.8.3] at Com.alibaba.dubbo.registry.support.abstractregistry$saveproperties.run (Abstract REGISTRY.JAVA:150) [dubbo-2.8.3.jar:2.8.3] at Java.util.concurrent.ThreadPoolExecutor.runWorker (Threadpoolexecutor.java:1145) [na:1.7.0_60] at Java.util.concurrent.threadpoolexecutor$worker.run (threadpoolexecutor.java:615) [NA: 1.7.0_60] at Java.lang.Thread.run (thread.java:745) [na:1.7.0_60]
The error probably means that Dubbo failed while saving the service list, Can not lock the registry cache file/root/.dubbo/ Dubbo-registry-10.141.4.168.cache, unable to get the file lock, cannot save the service list. Cause of error
The reason for this is that while the service is registering with ZK, it caches the list of consumer, writes user.home/.dubbo/dubbo-registry-"+ url.gethost () +". Cache this file, When multiple provider are started on the same machine, there is a problem with file lock contention, which is reported in the above error. Solutions
Since this is due to a competitive file lock, it is possible to avoid this problem by having the service modules cache their own caches files.
This is done by adding file= "${catalina.home}/dubbo-registry/dubbo-registry.properties" to the XML configuration file in provider, as follows:
<dubbo:registry id= "Zkcenter" protocol= "Zookeeper" address= "${dubbo.zk_address}" file= "${catalina.home}/ Dubbo-registry/dubbo-registry.properties "/>
This will be generated in the Catalina.home directory dubbo-registry This directory, the cache file will be in the inside of the slow existence. References
Abstractregistry Lock PROBLEM:HTTPS://GITHUB.COM/ALIBABA/DUBBO/ISSUES/81