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 230475 - Extreme slowdown in all IDE while save changes to persistence.xml
Summary: Extreme slowdown in all IDE while save changes to persistence.xml
Status: RESOLVED WONTFIX
Alias: None
Product: javaee
Classification: Unclassified
Component: Persistence (show other bugs)
Version: 7.4
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Sergey Petrov
URL:
Keywords: PERFORMANCE
Depends on:
Blocks:
 
Reported: 2013-05-29 18:15 UTC by ecerichter
Modified: 2016-07-07 08:55 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
IDE log (120.17 KB, text/plain)
2013-05-29 18:15 UTC, ecerichter
Details
Self sampler (116.92 KB, application/octet-stream)
2013-05-29 20:31 UTC, ecerichter
Details
Better sampler (379.04 KB, application/octet-stream)
2013-05-30 01:56 UTC, ecerichter
Details

Note You need to log in before you can comment on or make changes to this bug.
Description ecerichter 2013-05-29 18:15:13 UTC
Product Version = NetBeans IDE Dev (Build 201305262300)
Operating System = Windows 7 version 6.1 running on amd64
Java; VM; Vendor = 1.7.0_17
Runtime = Java HotSpot(TM) 64-Bit Server VM 23.7-b01

While editing a XML file in source code (more precisely, a Persistence Unit xml file), after the typing <!--, IDE is blocked for a long time. After is released, and I can finish the block.
In IDE log I can see the following message:

INFO [org.netbeans.modules.j2ee.persistence.unit.PUDataObject]
java.lang.RuntimeException: DOM graph creation failed: org.netbeans.modules.schema2beans.Schema2BeansRuntimeException: Failed to create the XML-DOM Document.  Check your XML to make sure it is correct.
The string "--" is not permitted within comments.
	at org.netbeans.modules.j2ee.persistence.dd.persistence.model_2_0.Persistence.createGraph(Persistence.java:235)
	at org.netbeans.modules.j2ee.persistence.dd.persistence.model_2_0.Persistence.createGraph(Persistence.java:226)
[catch] at org.netbeans.modules.j2ee.persistence.unit.PUDataObject.parseDocument(PUDataObject.java:215)
	at org.netbeans.modules.j2ee.persistence.unit.PUDataObject$ModelSynchronizer.reloadModelFromData(PUDataObject.java:500)
	at org.netbeans.modules.xml.multiview.XmlMultiViewDataSynchronizer.reloadModel(XmlMultiViewDataSynchronizer.java:230)
	at org.netbeans.modules.xml.multiview.XmlMultiViewDataSynchronizer$3.run(XmlMultiViewDataSynchronizer.java:100)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1432)
	at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2042)
WARNING [org.netbeans.core.TimableEventQueue]: too much time in AWT thread org.netbeans.modules.sampler.InternalSampler@77434274
Comment 1 ecerichter 2013-05-29 18:15:20 UTC
Created attachment 135092 [details]
IDE log
Comment 2 Svata Dedic 2013-05-29 19:47:33 UTC
If you can reproduce the issue repeatedly, could you please run the self-profiler (alt-shift-y) prior to making the comment ? Save the snapshot & attach here, please. There is a lot of Schema2BeansRuntimeExceptions but not so much they could cause the observed slowdown.
Comment 3 ecerichter 2013-05-29 20:31:04 UTC
Created attachment 135099 [details]
Self sampler

I've optimized Garbage Collection, and the slowdown has reduced.
But the error is still happening.
See attached a self-sampler of the issue.
Comment 4 ecerichter 2013-05-30 01:56:00 UTC
Created attachment 135108 [details]
Better sampler
Comment 5 Svata Dedic 2013-05-30 08:17:02 UTC
Was something else running on the machine ? Background build, antivirus software, some disk check, ... ? OS file operations take a lot of time in the snapshot and some are visible even in the log, e.g. 
WARNING [org.netbeans.modules.masterfs.filebasedfs.utils.FileChangedManager]: 1,950 ms in new File("C:\Users\richter\AppData\Local\NetBeans\Cache\dev\index\s1227\TaskListIndexer\2").exists()


The EDT is blocked by JPAProblemFinder; it should run in a separate thread, but that does fix the performance defect only makes the IDE more responsive.
Comment 6 ecerichter 2013-05-30 15:17:40 UTC
(In reply to comment #5)
> Was something else running on the machine ? Background build, antivirus
> software, some disk check, ... ? OS file operations take a lot of time in the
> snapshot and some are visible even in the log, e.g. 

I have Microsoft Security Essentials running in background - but I've disabled monitoring of NetBeans, AppData and Project folders to avoid extra hassle.

Also, I'm running Tomcat and PostgreSQL - but this "freeze" doesn't happen with DEV 201305222300, only after updade.

Maybe I've some corrupted index from previous version? How can I clean only indexes without loosing all my current configuration?

> WARNING [org.netbeans.modules.masterfs.filebasedfs.utils.FileChangedManager]:
> 1,950 ms in new
> File("C:\Users\richter\AppData\Local\NetBeans\Cache\dev\index\s1227\TaskListIndexer\2").exists()

Indeed, when NetBeans "freeze", disk activity go high.
Also, it stay repeating the "Refreshing indexes" all the time (I can see in the activity bar at down right corner).
When I open the "Action Items" window, then it becomes almost unusable.

> 
> 
> The EDT is blocked by JPAProblemFinder; it should run in a separate thread, but
> that does fix the performance defect only makes the IDE more responsive.

Does fix or Doesn't fix? I did not understand your last paragraph.
Comment 7 Sergey Petrov 2013-05-30 15:39:13 UTC
there was no changes in persistence area this week as I remember.
it seems quite slow if File.exists take almost 2 seconds, there may be some changes in antivurus of some other background activity. is cache and user directory both in antivirus exclusion list?

regarding cache director, see you message.log for 'Cache Directory'.

move to separate thread may help with ide response but if there is hdd overload it may stuck at some other point, just the same as if mozilla overload disk, I can't work with netbeans even it's in another thread.
But I need to evaluate the issue, as there may be some unnecessary chacks and also do not block edt thread.
Comment 8 Sergey Petrov 2013-05-30 15:47:14 UTC
also there may be some changes in your project, or in open files or in open tabs.
Comment 9 ecerichter 2013-05-30 15:51:20 UTC
(In reply to comment #7)
> there was no changes in persistence area this week as I remember.
> it seems quite slow if File.exists take almost 2 seconds, there may be some
> changes in antivurus of some other background activity. is cache and user
> directory both in antivirus exclusion list?

Cache and user directory are both in exclusion list.

> 
> regarding cache director, see you message.log for 'Cache Directory'.

I'll look at it.

> 
> move to separate thread may help with ide response but if there is hdd overload
> it may stuck at some other point, just the same as if mozilla overload disk, I
> can't work with netbeans even it's in another thread.

Seems unlikely. This is a very fast machine (AMD 8 core 3.1Ghz, Sata 3 disks
high speed, 8Gb kingston memories, decent ASUS motherboard) - and as I said,
started after update to DEV 201305282300. I can move back to 201305222300, but
I see no gain for that.

> But I need to evaluate the issue, as there may be some unnecessary chacks and
> also do not block edt thread.

Ok. Let me know if you me to test anything.
I've reduced a bit the slowdown with the following customization in my
netbeans.conf:


netbeans_default_options="--locale en:US -J-Xmx2g -J-client -J-XX:+UseParNewGC
-J-XX:ParallelGCThreads=4 -J-XX:MaxGCPauseMillis=500 -J-XX:+DisableExplicitGC
-J-XX:+PrintCommandLineFlags -J-XX:+UseConcMarkSweepGC
-J-XX:+CMSClassUnloadingEnabled -J-XX:+CMSPermGenSweepingEnabled
-J-Dnetbeans.logger.console=true -J-ea -J-Dapple.laf.useScreenMenuBar=true
-J-Dapple.awt.graphics.UseQuartz=true -J-Dsun.java2d.noddraw=true
-J-Dsun.java2d.dpiaware=true -J-Dsun.zip.disableMemoryMapping=true
-J-Dplugin.manager.check.updates=false
-J-Dnetbeans.extbrowser.manual_chrome_plugin_install=yes"

Originally, I did not customization, and then NetBeans was always getting out
of memory while compiling source's folder.
Comment 10 ecerichter 2013-05-30 15:54:05 UTC
Would this affect my performance:

"WARNING [org.netbeans.modules.masterfs.watcher.Watcher]: Cannot add filesystem watch for E:/: java.io.IOException: Unable to open null: 3"

All my projects are under drive E:
Comment 11 Sergey Petrov 2013-05-30 16:08:02 UTC
Do you mean heap increase? sometimes memory lack may cause slowness also.
Regarding watcher, I don't know but it may be something related to next item with recent projects ans shouldn't affect performance in this case.
Comment 12 Sergey Petrov 2013-05-31 13:06:38 UTC
Initial use case have a problem with performance right after <!-- addition but "better sampler" have main problem after "save" action, what is real use case?
Comment 13 ecerichter 2013-06-04 20:40:08 UTC
Yes, I made tests with DEV 201306032300, and the problem is related to save action.

Usually, I type fast, and use keyboard shortcuts for actions (like save), that's why my perception that the problem was with editing speed.
Comment 14 Martin Balin 2016-07-07 08:55:11 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