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

缓存文件找不到, 导致的死循环 #6140

Closed
lizhibo0914 opened this issue May 12, 2020 · 2 comments
Closed

缓存文件找不到, 导致的死循环 #6140

lizhibo0914 opened this issue May 12, 2020 · 2 comments

Comments

@lizhibo0914
Copy link

正式项目中, 发现dubbo在运行中 ,出现了缓存文件找不到的现象出现了死循环, 疯狂打印日志, 导致cpu特别高, 一直循环打印: Failed to save registry store file, cause: 没有那个文件活目录

@Huangxuny1
Copy link
Contributor

hello @lizhibo0914 ,

by given information , Failed to save registry store file, cause: 没有那个文件活目录 maybe print from AbstractRegistry.java

I am try to reproduce by a test in AbstractRegistryTest.java

    @Test
    public void testDoSaveProperties() throws NoSuchFieldException, IllegalAccessException, IOException {
        String defaultFilename = System.getProperty("user.home") + "/.dubbo/dubbo-registry-" + testUrl.getParameter(APPLICATION_KEY) + "-" + testUrl.getAddress().replaceAll(":", "-") + ".cache";
        File mockFile = spy(new File(defaultFilename));
        Field fileField = abstractRegistry.getClass().getSuperclass().getDeclaredField("file");
        fileField.setAccessible(true);
        fileField.set(abstractRegistry, mockFile);

        doReturn(false).when(mockFile).exists();
        doThrow(new IOException(" no such file or dir ")).when(mockFile).createNewFile();
        abstractRegistry.doSaveProperties(1);
    }

but I cannot reproduce it

it's output

[17/05/20 15:09:53:263 CST]  WARN support.AbstractRegistryTest$1:  [DUBBO] Failed to save registry cache file, will retry, cause:  no such file or dir , dubbo version: , current host: 192.168.1.83
java.io.IOException:  no such file or dir 
	at org.apache.dubbo.registry.support.AbstractRegistry.doSaveProperties(AbstractRegistry.java:187)
	at org.apache.dubbo.registry.support.AbstractRegistry$SaveProperties.run(AbstractRegistry.java:526)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)
[17/05/20 15:09:53:263 CST]  WARN support.AbstractRegistryTest$1:  [DUBBO] Failed to save registry cache file, will retry, cause:  no such file or dir , dubbo version: , current host: 192.168.1.83
java.io.IOException:  no such file or dir 
	at org.apache.dubbo.registry.support.AbstractRegistry.doSaveProperties(AbstractRegistry.java:187)
	at org.apache.dubbo.registry.support.AbstractRegistry$SaveProperties.run(AbstractRegistry.java:526)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)
[17/05/20 15:09:53:289 CST]  WARN support.AbstractRegistryTest$1:  [DUBBO] Failed to save registry cache file after retrying 3 times, cause:  no such file or dir , dubbo version: , current host: 192.168.1.83
java.io.IOException:  no such file or dir 
	at org.apache.dubbo.registry.support.AbstractRegistry.doSaveProperties(AbstractRegistry.java:187)
	at org.apache.dubbo.registry.support.AbstractRegistry$SaveProperties.run(AbstractRegistry.java:526)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)

maybe it'd fixed in #3748

can you give a demo program to reproduce
or tell us more information such as dubbo version or StackTrace ?

@CrazyHZM
Copy link
Member

No feedback for a long time, please close the issue temporarily. If there is still a problem, you can reopen it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants