This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 242623 - high cpu usage when editing, showing "checking for external changes"
Summary: high cpu usage when editing, showing "checking for external changes"
Status: REOPENED
Alias: None
Product: editor
Classification: Unclassified
Component: CSL (API & infrastructure) (show other bugs)
Version: 8.0
Hardware: PC Linux
: P3 normal with 15 votes (vote)
Assignee: Milutin Kristofic
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-03-06 17:40 UTC by mkj
Modified: 2018-12-26 08:12 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
IDE log (742.38 KB, text/plain)
2014-03-06 17:40 UTC, mkj
Details
nb profiler screendump (85.58 KB, image/png)
2014-03-11 06:48 UTC, mkj
Details
IDE log2 (108.48 KB, text/x-log)
2014-03-22 06:10 UTC, vkhashin
Details
12-13% cpu constant usage. (167.72 KB, image/png)
2016-09-30 08:35 UTC, mihai
Details
.npss file attached from NetBeans (121.15 KB, application/x-npss)
2016-09-30 08:41 UTC, mihai
Details
looks like a thread has some problems. (65.61 KB, image/png)
2016-09-30 09:04 UTC, mihai
Details

Note You need to log in before you can comment on or make changes to this bug.
Description mkj 2014-03-06 17:40:33 UTC
Product Version = NetBeans IDE 8.0 RC1 (Build 201402242200)
Operating System = Linux version 3.13.5-gentoo running on amd64
Java; VM; Vendor = 1.7.0_51
Runtime = OpenJDK 64-Bit Server VM 24.51-b03

when editing a jsf/xhtml file in a maven j2ee project, then buttom bar sometimes says: "Checking for external changes" "Suspended", and stays that way, with 100% cpu usage on one of my cpu cores. while doing this the netbeans.log write several instances of:
   
    INFO [org.netbeans.modules.parsing.impl.TaskProcessor]: Task: class org.netbeans.modules.csl.hints.infrastructure.HintsTask ignored cancel for XXX ms.

... as shown in the log. when switching to editing a regular java file, it disappears and the cpu usage is back to normal.
Comment 1 mkj 2014-03-06 17:40:41 UTC
Created attachment 145811 [details]
IDE log
Comment 2 mkj 2014-03-11 06:48:53 UTC
Created attachment 145934 [details]
nb profiler screendump
Comment 3 mkj 2014-03-11 06:49:40 UTC
i profiled netbeans while the cpu load was high and saved the dump, if thats of any interest.
Comment 4 vkhashin 2014-03-22 06:09:52 UTC
I have the same problem. 

Product Version: NetBeans IDE 8.0 (Build 201403101706)
Java: 1.7.0_21; Java HotSpot(TM) Client VM 23.21-b01
Runtime: Java(TM) SE Runtime Environment 1.7.0_21-b11
System: Linux version 2.6.32-37-generic-pae running on i386; UTF-8; en_US (nb)

Also there is java.lang.IllegalStateException in the netbeans log.
java.lang.IllegalStateException
	at org.netbeans.modules.web.core.jsploader.BaseJspEditorSupport$4.propertyChange(BaseJspEditorSupport.java:180)
	at java.beans.PropertyChangeSupport.fire(PropertyChangeSupport.java:335)
	at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:327)
	at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:263)
	at org.openide.text.CloneableEditorSupport.firePropertyChange(CloneableEditorSupport.java:483)
	at org.openide.text.CloneableEditorSupport.fireDocumentChange(CloneableEditorSupport.java:1758)
	at org.openide.text.DocumentOpenClose$DocumentClose.run(DocumentOpenClose.java:997)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1423)
	at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2033)
Comment 5 vkhashin 2014-03-22 06:10:38 UTC
Created attachment 146243 [details]
IDE log2
Comment 6 bgunnink 2014-04-18 13:28:02 UTC
I can also attest to this problem, but it I get when with a Spring+JSP project, not JSF.

Product Version: NetBeans IDE 8.0 (Build 201403101706)
Java: 1.7.0_51; Java HotSpot(TM) 64-Bit Server VM 24.51-b03
Runtime: Java(TM) SE Runtime Environment 1.7.0_51-b13
System: Windows 8 version 6.2 running on amd64; Cp1252; en_US (nb)

Seeing the same basic log contents as vkhashin.
Comment 7 roben 2014-05-05 15:36:10 UTC
Same issue here. The problem goes away when closing and re-opening the project whereas restarting the IDE does not help.
Comment 8 roben 2014-05-05 15:39:11 UTC
Product Version: NetBeans IDE 8.0 (Build 201403101706)
Updates: NetBeans IDE is updated to version NetBeans 8.0 Patch 1
Java: 1.8.0; Java HotSpot(TM) 64-Bit Server VM 25.0-b70
Runtime: Java(TM) SE Runtime Environment 1.8.0-b132
System: Mac OS X version 10.9.2 running on x86_64; UTF-8; de_DE (nb)
Comment 9 roben 2014-05-07 09:31:22 UTC
I disabled scanning for external changes in the files dialog but the problem still resides. The only difference is, that "Checking for external changes" "Suspended" is no longer being displayed while netbeans still uses up 100% cpu. Closing and re-opening the project fixes the issue temporarily until the load goes up again.

My guess is that git is somehow related to the issue because I often notice the problem after switching branches, commiting and merging. Can be coincidence, though.
Comment 10 roben 2014-05-20 12:04:58 UTC
I just noted that it is simply enough to close all editor windows to let the cpu load come back to normal. Re-opening a single editor causes the issue again immediately, though.
Comment 11 pmi 2014-05-26 14:17:44 UTC
I have the same problem.
This is a result of command top:
PID   COMMAND      %CPU  TIME     #TH   #WQ  #PORT #MREGS MEM    RPRVT  PURG   CMPR VPRVT  VSIZE  PGRP PPID STATE    UID  FAULTS    COW     MSGSENT   MSGRECV   SYSBSD
2805  java         127.1 14:33.35 42/1  0    285   1684   965M+  943M+  8192B  0B   1177M  4430M  2567 2567 running  501  1549725+  6573    365554+   154567    6072042+
Comment 12 pmi 2014-05-26 14:25:42 UTC
Product Version = NetBeans IDE 8.0
Operating System = Mac os x 10.9.3

java version "1.7.0_45"
Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)
Comment 13 opensolutions 2014-05-26 14:28:38 UTC
here, too. mac os 10.9.3 java 7 and 8

change ticket to hardware "PC" "All" ?
Comment 14 roben 2014-05-27 13:43:48 UTC
I've got some new findings: The issue seems to appear with larger .xhtml files opened in the editor. After truncating (depending on the file to somewhere between 100 and 300 lines) the load goes back to normal. It doesn't matter if I remove code from the beginning or the end of the file. I also removed the small overlapping fragment in one case just to be sure but it did not change anything. I can verify this with different files. Sadly as my project is closed source I am not able to provide example data.

Can anybody else confirm this behavior?
Comment 15 roben 2014-05-27 14:53:04 UTC
Addition: Event changing to a different editor tab suffices to let the cpu calm down.

Large .xhtml file with high load:
https://www.dropbox.com/s/m42cugkc8fyg8eu/Screenshot%202014-05-27%2016.51.42.png

Different tab with small file, large file still open:
https://www.dropbox.com/s/u23o3k5v2vr74b4/Screenshot%202014-05-27%2016.51.58.png
Comment 16 pmi 2014-05-28 12:11:42 UTC
I made a new test with Java 8 but the problem is still there.
Comment 17 roben 2014-07-27 10:40:41 UTC
Is anyone reading this? This bug is really nasty...
Comment 18 aecrin 2014-07-31 02:04:42 UTC
I'm using Netbeans 8.0 :


Go to "Tools" ... "Options" ... "Editor" ... "Hints" ... 

Select Language : "Expression Language" and uncheck "Identifiers and Properties".


You'll see the difference.
Comment 19 aecrin 2014-08-01 15:29:54 UTC
In my case: CPU utilization went from 100% to less than 15%. I guess something is broken in that option.
Comment 20 roben 2014-08-01 17:06:03 UTC
Same thing here - load comes back to normal after unchecking the option. Thanks for the hint!

So should we open a new issue? This one here seems somehow unnoticed/ignored...
Comment 21 aecrin 2014-08-01 19:13:43 UTC
I hope somobody fixes the issue. since ther is enough info to isolate the problem. ... :

What are the symptoms ?? ... 100% CPU utilization ( which causes suspended background tasks and general POOR PERFORMANCE ).

When it happens ?? ... when editing large .xhtml files

Where is it ?? ... in the option "Identifiers and Properties" of "Expression Language" ... ( Editor : Hints )

Who is affected ?? ... people working with .xhtml files ( JSF, Java Web, etc ).
Comment 22 yaronel 2014-11-11 17:04:30 UTC
I posted a bug which I believe is related to this one:
https://netbeans.org/bugzilla/show_bug.cgi?id=248494
Comment 23 Martin Balin 2016-07-07 07:27:22 UTC
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue.

Thanks for your cooperation,
NetBeans IDE 8.2 Release Boss
Comment 24 temistokles 2016-09-05 12:02:46 UTC
Unfortunatelly the issue is still present in thunk
Comment 25 mihai 2016-09-30 08:30:32 UTC
It is still present in NetBeans Dev 201608160002 and NetBeans 8.2 RC.
Comment 26 mihai 2016-09-30 08:35:12 UTC
Created attachment 162282 [details]
12-13% cpu constant usage.
Comment 27 mihai 2016-09-30 08:41:33 UTC
Created attachment 162283 [details]
.npss file attached from NetBeans

.npss file
Comment 28 mihai 2016-09-30 09:04:57 UTC
Created attachment 162285 [details]
looks like a thread has some problems.
Comment 29 mihai 2016-10-01 18:27:12 UTC
until now, it looks like this is solving my problem:

http://stackoverflow.com/questions/6268031/how-can-i-disable-scan-for-external-changes-in-netbeans#6268263
Comment 30 stevieegee 2016-11-29 13:32:08 UTC
This worked for me. Netbeans 8.2. Mac. I was having similar problems with "Scan for external changes" and indexing. After going to Window->Reset Windows is has magically fixed the problem.
Comment 31 arnisraido 2016-12-23 16:14:49 UTC
This problem still persists in the latest 8.2 version too.

We are using SFTP or FTP connections (using WinSCP). For us - there is no need to check for external changes. The file anyway is downloaded locally and saved in temp folder. Netbeans edits it from there.

But the cirital problem is -if you turn off "Scan for external changes" but file has really changed on the server side, then opening it from SFTP client (e.g. - WinSCP - doble click on file or choose "edit" ) **will not refresh the file in the editor!**

This is critical.
Comment 32 bradjorgensen 2017-01-05 20:27:52 UTC
Is anyone working on this issue? I'm switching my development team to netbeans but this issue is holding us back from fully using it.
Comment 33 Echa 2017-03-11 22:16:42 UTC
I'm having this issue on BOTH my work machines. Clearing the cache in Appdata helps for a little while, but then returns back to the previous state.

I just had to kill Netbeans because it hung when creating a new source file.

Windows 10 on both machines.

I've only been really working on one project for the past month or so, but will keep an eye out to see if it's reproducible in other projects.
Comment 34 xkr 2017-03-14 15:12:40 UTC
Hi,
I have the same issue in my project regularly with version 8.2. What kind of info do you want to collect?
Comment 35 hanslohuis 2017-05-04 07:12:12 UTC
I have the same problem with NB 8.2 and large .xhtml-Files. Is there anyone, who work on this issue?
Comment 36 abujunayd 2017-06-01 14:24:55 UTC
(In reply to stevieegee from comment #30)
> This worked for me. Netbeans 8.2. Mac. I was having similar problems with
> "Scan for external changes" and indexing. After going to Window->Reset
> Windows is has magically fixed the problem.

Awesome! I tried other suggestions but that one is the only one that worked for me. Thanks for sharing.

Netbeans went from an average of 35% while IDLE to less than 1% - I could even re-enable the auto-scan for external changes as well as the default hints - all working great now! The reset window was all that was needed.
Comment 37 tilman 2017-07-31 09:19:31 UTC
I had this problem too (got slower and slower and then unresponsive), initially after some work (especially "diff" to an external file), later immediately after start. Open files were java, pom.xml, maybe spring applicationcontext.xml.

What I tried unsuccessfully:
- deleting the cache
- deleting the maven repository
- setting -Xmx3g

What succeeded:
- close all files, then netbeans and then reopening netbeans.
Comment 38 tilman 2017-07-31 09:20:28 UTC
This was with Netbeans 8.2 on Windows 7.
Comment 39 spynet71 2017-08-02 16:37:46 UTC
In my case solution from aecrin@netbeans.org #comment21 work for me
I working with jsf project
Comment 40 burgrp 2017-09-05 17:37:44 UTC
The same here. Netbeans 8.2, Linux Mint Xfce.
Comment 41 marco.marsala 2018-03-23 09:17:34 UTC
Netbeans IDE CPU usage is 100% 1-core when any .php file is just opened (and its tab is focused).

This happens with small files too, I mean under than 2000 lines.

After closing all files the CPU usage immediately returns to 0%.

Thanks to your suggestion, I disabled all hints and CPU usage went normal.

However, "Hints" feature must be fixed.
Comment 42 arsi_sk 2018-12-26 08:12:52 UTC
I spent several hours debugging and in my case the problem is caused by Unix domain socket in /tmp directory. Directory watch service is calling BaseFileObj.refresh(final boolean expected, boolean fire) and the test on this file:

final boolean isDir = file.isDirectory();
final boolean isFile = file.isFile();
if (isDir == isFile || isFolder() != isDir || isData() != isFile) {
     invalidateFO(fire, expected, true);
}

isDir == isFile -> false == false

And it's called over and over again. 

After changing java tmp directory location, the problem no longer arises.

-J-Djava.io.tmpdir=/custom/tmp