Type: bug report
Error creating cache directory at startup time
启动时报建立缓存目录错误
Occasionally reporting cache creation errors at startup,The error message is as follows:
启动时偶发性报建立缓存错误,错误信息如下:
java.lang.IllegalStateException: failed to create cache dir: /root/nacos/naming/public
at com.alibaba.nacos.client.naming.cache.DiskCache.makeSureCacheDirExists(DiskCache.java:155) ~[nacos-client-1.0.0.jar!/:na]
at com.alibaba.nacos.client.naming.cache.DiskCache.write(DiskCache.java:45) ~[nacos-client-1.0.0.jar!/:na]
启动
centos 7、java8
com.alibaba.nacos.client.naming.cache.DiskCache类里面
第49行第50行的注释做了多实例冲突的优化处理,然而第153行同样的场景却未做同样的优化处理。
Inside the com.alibaba.nacos.client.naming.cache.DiskCache class
The comment in line 49, line 50, optimizes multi-instance conflicts, but the same scenario in line 153 does not.
Hi @lcg72, we detect non-English characters in the issue. This comment is an auto translation from @nacos-bot to help other users to understand this issue.
We encourage you to describe your issue in English which is more friendly to other users.
Type: bug report
Error creating cache directory at startup time
Start time register to create cache directory error
Occasionally reporting cache creation errors at startup,The error message is as follows:
A sporadic report creates a cache error at startup, and the error message is as follows:
java.lang.IllegalStateException: failed to create cache dir: /root/nacos/naming/public
at com.alibaba.nacos.client.naming.cache.DiskCache.makeSureCacheDirExists(DiskCache.java:155) ~[nacos-client-1.0.0.jar!/:na]
at com.alibaba.nacos.client.naming.cache.DiskCache.write(DiskCache.java:45) ~[nacos-client-1.0.0.jar!/:na]
start up
centos 7、java8
Inside the com.alibaba.nacos.client.naming.cache.DiskCache class
The comment on line 49 and line 50 does the optimization of the multi-instance conflict, but the same scenario on line 153 does not do the same optimization.
Inside the com.alibaba.nacos.client.naming.cache.DiskCache class
The comment in line 49, line 50, optimizes multi-instance conflicts, but the same scenario in line 153 does not.
I think this might happen rarely and only happen at first time(the directory /root/nacos/naming/public not exists).
Has it happened to you many times?
My application runs in docker, so every update will create a new docker container, and this error is often visible.
Virgo, it's not good to see any mistakes.
When the application of the new docker container restarts, there will be multiple configuration information to be cached. Example A first determines whether the directory exists or not, and then creates the directory if it does not exist. This takes a little time. When instance A has not built the directory yet, Example B judges that the directory does not exist, and also does the operation of creating the directory. Failure to create directories
I suppose this is thread conflicted at first, but now i think that is JVM conflicted .
Most helpful comment
Virgo, it's not good to see any mistakes.