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

Error creating cache directory at startup time [starting the time register to create a cache directory error] #1840

Closed
lcg72 opened this issue Sep 11, 2019 · 7 comments · Fixed by #1844
Labels
kind/bug Category issues or prs related to bug.

Comments

@lcg72
Copy link

lcg72 commented Sep 11, 2019

Issue Description

Type: bug report

Describe what happened (or what feature you want)

Error creating cache directory at startup time
启动时报建立缓存目录错误

Describe what you expected to happen

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]

How to reproduce it (as minimally and precisely as possible)

启动

Tell us your environment

centos 7、java8

Anything else we need to know?

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.

@nacos-bot nacos-bot added the kind/bug Category issues or prs related to bug. label Sep 11, 2019
@nacos-bot
Copy link
Collaborator

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.

Error creating cache directory at startup time [starting the time register to create a cache directory error]

Issue Description

Type: bug report

Describe what happened (or what feature you want)

Error creating cache directory at startup time
Start time register to create cache directory error

Describe what you expected to happen

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]

How to reproduce it (as minimally and precisely as possible)

start up

Tell us your environment

centos 7、java8

Anything else we need to know?

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.

@nacos-bot nacos-bot changed the title Error creating cache directory at startup time[启动时报建立缓存目录错误] Error creating cache directory at startup time [starting the time register to create a cache directory error] Sep 11, 2019
@stackisok
Copy link
Contributor

I think this might happen rarely and only happen at first time(the directory /root/nacos/naming/public not exists).

@stackisok
Copy link
Contributor

Has it happened to you many times?

@lcg72
Copy link
Author

lcg72 commented Sep 11, 2019

My application runs in docker, so every update will create a new docker container, and this error is often visible.

@lcg72
Copy link
Author

lcg72 commented Sep 11, 2019

Virgo, it's not good to see any mistakes.

@lcg72
Copy link
Author

lcg72 commented Sep 11, 2019

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

@stackisok stackisok mentioned this issue Sep 11, 2019
5 tasks
@stackisok
Copy link
Contributor

I suppose this is thread conflicted at first, but now i think that is JVM conflicted .

@stackisok stackisok mentioned this issue Sep 11, 2019
5 tasks
nkorange added a commit that referenced this issue Oct 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Category issues or prs related to bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants