You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by "TLX (Jira)" <ji...@apache.org> on 2020/12/18 20:30:00 UTC

[jira] [Created] (NETBEANS-5169) Active Reference Queue Daemon handling thousands of irrelevant files, causing high CPU load and bad responsiveness

TLX created NETBEANS-5169:
-----------------------------

             Summary: Active Reference Queue Daemon handling thousands of irrelevant files, causing high CPU load and bad responsiveness
                 Key: NETBEANS-5169
                 URL: https://issues.apache.org/jira/browse/NETBEANS-5169
             Project: NetBeans
          Issue Type: Bug
    Affects Versions: 12.0
            Reporter: TLX
         Attachments: image-2020-12-18-21-25-11-633.png

For several versions NetBeans has been getting stuck with a message "Checking for external changes" in the status bar and consuming a lot of CPU (which is noisy on my development notebook).

I used VisualVM to find out what's going on, and this is what I found out:

The high CPU consumption is caused by a thread named "Active Reference Queue Daemon".

This thread keeps checking thousands or even millions of events all the time. Most of the actual CPU consumption happens in methods java.io.File.isDirectory(), java.io.File.canWrite(), java.ioFile.lastModified(), java.io.File.exists(), and java.io.File.isFile() called by the mentioned thread.

What I *think* is *supposed* to happen is that NetBeans monitors files that are relevant for the project at hand for modifications.

What *actually* happens is that this Queue is filled with thousands of files from the system Temp folder, many of which seem completely unrelated to the project and to NetBeans.

Why is NetBeans monitoring those?

Monitoring them due to a bug wouldn't be a big problem if they remained unmodified, I presume. However, it seems some of these files are continuously modified by other applications on my dev system, keeping NetBeans busy with checking them all the time.

It is worth noting that only the NetBeans editor is running at the time of the problem. No service, no Java process, no debugger, profiler, or anything else is running or attached to anything. Monitoring thousands of files in the Temp folder seems totally useless to me.

---------------------

As an appendix I'll provide the following:
 # Two examples of typical stack traces the mentioned daemon thread is busy in.
 # An impression what the queue looks like (taken from a heap dump).

 

The stack traces:
{code:java}
"Active Reference Queue Daemon" daemon prio=1 tid=13 RUNNABLE
    at java.io.WinNTFileSystem.getBooleanAttributes(Native Method)
    at java.io.File.isDirectory(File.java:849)
    at org.netbeans.modules.masterfs.filebasedfs.utils.FileInfo.isDirectory(FileInfo.java:75)
    at org.netbeans.modules.masterfs.filebasedfs.naming.NamingFactory.fromFile(NamingFactory.java:103)
       local variable: org.netbeans.modules.masterfs.filebasedfs.naming.FolderName#9847
       local variable: org.netbeans.modules.masterfs.filebasedfs.utils.FileInfo#2
       local variable: java.util.ArrayList#315448
       local variable: java.util.ArrayList$Itr#4
    at org.netbeans.modules.masterfs.filebasedfs.naming.NamingFactory.fromFile(NamingFactory.java:84)
    at org.netbeans.modules.masterfs.filebasedfs.children.ChildrenSupport$2IOJob.run(ChildrenSupport.java:249)
       local variable: java.io.File[]#13
       local variable: org.netbeans.modules.masterfs.filebasedfs.children.ChildrenSupport$2IOJob#2
    at org.netbeans.modules.masterfs.filebasedfs.fileobjects.FolderObj.refreshImpl(FolderObj.java:442)
       local variable: org.openide.util.Mutex$Privileged#2
       local variable: org.netbeans.modules.masterfs.filebasedfs.fileobjects.FolderObj$FolderChildrenCache#7559
       local variable: java.lang.Runnable[]#3
    at org.netbeans.modules.masterfs.filebasedfs.fileobjects.BaseFileObj.refresh(BaseFileObj.java:868)
       local variable: org.netbeans.modules.masterfs.filebasedfs.Statistics$StopWatch#4
    at org.netbeans.modules.masterfs.filebasedfs.fileobjects.FolderObj.refresh(FolderObj.java:537)
    at org.openide.filesystems.FileObject.refresh(FileObject.java:1194)
    at org.netbeans.modules.masterfs.filebasedfs.fileobjects.FileObjectFactory$AsyncRefreshAtomicAction.run(FileObjectFactory.java:886)
    at org.openide.filesystems.EventControl.runAtomicAction(EventControl.java:102)
       local variable: org.openide.filesystems.EventControl#3
    at org.openide.filesystems.FileSystem.runAtomicAction(FileSystem.java:494)
    at org.openide.filesystems.FileUtil.runAtomicAction(FileUtil.java:397)
    at org.netbeans.modules.masterfs.filebasedfs.fileobjects.FileObjectFactory.refreshFromGetter(FileObjectFactory.java:894)
    at org.netbeans.modules.masterfs.filebasedfs.fileobjects.FileObjectFactory.issueIfExist(FileObjectFactory.java:301)
       local variable: org.netbeans.modules.masterfs.filebasedfs.fileobjects.FileObjectFactory$Caller#6
       local variable: org.netbeans.modules.masterfs.filebasedfs.fileobjects.FileObj#3169
       local variable: java.io.File#74439
       local variable: java.lang.Integer#140750
    at org.netbeans.modules.masterfs.filebasedfs.fileobjects.FileObjectFactory.getFileObject(FileObjectFactory.java:207)
    at org.netbeans.modules.masterfs.filebasedfs.fileobjects.FolderObj.computeChildren(FolderObj.java:168)
       local variable: org.netbeans.modules.masterfs.filebasedfs.fileobjects.FileObjectFactory#1
       local variable: org.netbeans.modules.masterfs.filebasedfs.naming.FileName#44684
       local variable: java.util.LinkedHashMap#14210
       local variable: java.util.HashMap$KeyIterator#2
       local variable: org.netbeans.modules.masterfs.filebasedfs.utils.FileInfo#4
    at org.netbeans.modules.masterfs.filebasedfs.fileobjects.FolderObj.noFolderListeners(FolderObj.java:117)
    at org.netbeans.modules.masterfs.filebasedfs.fileobjects.BaseFileObj.removeFileChangeListener(BaseFileObj.java:538)
    at sun.reflect.GeneratedMethodAccessor593.invoke(<unknown string>)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.openide.util.WeakListenerImpl$ListenerReference.run(WeakListenerImpl.java:619)
       local variable: class org.netbeans.modules.masterfs.filebasedfs.fileobjects.FolderObj
       local variable: org.openide.util.WeakListenerImpl$ProxyListener#44981
       local variable: org.netbeans.modules.masterfs.filebasedfs.fileobjects.FolderObj#7540
       local variable: java.lang.String#1541634
       local variable: java.lang.reflect.Method#8031
    at org.openide.util.lookup.implspi.ActiveQueue$Daemon.run(ActiveQueue.java:123)
       local variable: org.openide.util.WeakListenerImpl$ListenerReference#123808 {code}
{code:java}
  
"Active Reference Queue Daemon" daemon prio=1 tid=13 RUNNABLE
    at java.io.WinNTFileSystem.getBooleanAttributes(Native Method)
    at java.io.File.isFile(File.java:882)
    at org.netbeans.modules.masterfs.filebasedfs.fileobjects.BaseFileObj.refresh(BaseFileObj.java:872)
       local variable: org.netbeans.modules.masterfs.filebasedfs.fileobjects.FileObj#7086
       local variable: org.netbeans.modules.masterfs.filebasedfs.Statistics$StopWatch#4
    at org.netbeans.modules.masterfs.filebasedfs.fileobjects.FileObj.refresh(FileObj.java:355)
    at org.netbeans.modules.masterfs.filebasedfs.fileobjects.FolderObj.refreshImpl(FolderObj.java:459)
       local variable: java.util.IdentityHashMap#258
       local variable: java.util.HashMap$KeyIterator#1
    at org.netbeans.modules.masterfs.filebasedfs.fileobjects.BaseFileObj.refresh(BaseFileObj.java:868)
       local variable: org.netbeans.modules.masterfs.filebasedfs.Statistics$StopWatch#5
    at org.netbeans.modules.masterfs.filebasedfs.fileobjects.FolderObj.refresh(FolderObj.java:537)
    at org.openide.filesystems.FileObject.refresh(FileObject.java:1194)
    at org.netbeans.modules.masterfs.filebasedfs.fileobjects.FileObjectFactory$AsyncRefreshAtomicAction.run(FileObjectFactory.java:886)
    at org.openide.filesystems.EventControl.runAtomicAction(EventControl.java:102)
       local variable: org.openide.filesystems.EventControl#3
    at org.openide.filesystems.FileSystem.runAtomicAction(FileSystem.java:494)
    at org.openide.filesystems.FileUtil.runAtomicAction(FileUtil.java:397)
    at org.netbeans.modules.masterfs.filebasedfs.fileobjects.FileObjectFactory.refreshFromGetter(FileObjectFactory.java:894)
    at org.netbeans.modules.masterfs.filebasedfs.fileobjects.FileObjectFactory.issueIfExist(FileObjectFactory.java:301)
       local variable: org.netbeans.modules.masterfs.filebasedfs.fileobjects.FileObjectFactory$Caller#6
       local variable: org.netbeans.modules.masterfs.filebasedfs.fileobjects.FileObj#3904
       local variable: java.io.File#60893
       local variable: java.lang.Integer#147047
    at org.netbeans.modules.masterfs.filebasedfs.fileobjects.FileObjectFactory.getFileObject(FileObjectFactory.java:207)
    at org.netbeans.modules.masterfs.filebasedfs.fileobjects.FolderObj.computeChildren(FolderObj.java:168)
       local variable: org.netbeans.modules.masterfs.filebasedfs.fileobjects.FileObjectFactory#1
       local variable: org.netbeans.modules.masterfs.filebasedfs.naming.FileName#48075
       local variable: java.util.LinkedHashMap#14132
       local variable: java.util.HashMap$KeyIterator#2
       local variable: org.netbeans.modules.masterfs.filebasedfs.utils.FileInfo#3
    at org.netbeans.modules.masterfs.filebasedfs.fileobjects.FolderObj.noFolderListeners(FolderObj.java:117)
    at org.netbeans.modules.masterfs.filebasedfs.fileobjects.BaseFileObj.removeFileChangeListener(BaseFileObj.java:538)
    at sun.reflect.GeneratedMethodAccessor593.invoke(<unknown string>)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.openide.util.WeakListenerImpl$ListenerReference.run(WeakListenerImpl.java:619)
       local variable: class org.netbeans.modules.masterfs.filebasedfs.fileobjects.FolderObj
       local variable: org.openide.util.WeakListenerImpl$ProxyListener#44760
       local variable: org.netbeans.modules.masterfs.filebasedfs.fileobjects.FolderObj#7533
       local variable: java.lang.reflect.Method#7669
       local variable: java.lang.String#1457795
    at org.openide.util.lookup.implspi.ActiveQueue$Daemon.run(ActiveQueue.java:123)
       local variable: org.openide.util.WeakListenerImpl$ListenerReference#187634
{code}
The screenshot:

!image-2020-12-18-21-25-11-633.png!



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists