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 192548 - Netbeans 7 locking up when opening some source code (2)
Summary: Netbeans 7 locking up when opening some source code (2)
Status: RESOLVED FIXED
Alias: None
Product: editor
Classification: Unclassified
Component: Painting & Printing (show other bugs)
Version: 7.0
Hardware: PC Windows XP
: P1 normal with 1 vote (vote)
Assignee: Miloslav Metelka
URL:
Keywords:
: 192643 192964 193267 193734 196174 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-11-26 19:09 UTC by neil13
Modified: 2011-03-05 14:01 UTC (History)
10 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Thread dump (68.87 KB, text/plain)
2010-11-26 19:09 UTC, neil13
Details

Note You need to log in before you can comment on or make changes to this bug.
Description neil13 2010-11-26 19:09:29 UTC
Created attachment 103387 [details]
Thread dump

Create a Java application
add a persistence unit
try and edit the xml code

netbeans locks up and has to be shut down using task manager
Comment 1 Marian Mirilovic 2010-11-29 07:38:14 UTC
dup of issue 192558 ?
Comment 2 neil13 2010-11-29 12:07:49 UTC
yes possibly
i havent used netbeans 7 with JDK6 yet, so dont know if its a just a JDK7 problem
Comment 3 David Strupl 2010-11-29 12:19:59 UTC

*** This bug has been marked as a duplicate of bug 192558 ***
Comment 4 neil13 2010-11-29 12:34:22 UTC
I have just tried Netbeans 7 with JDK 1.6.0_22 and have the same problem, so have reopened the bug.
Comment 5 neil13 2010-11-29 12:36:56 UTC
bug 192558 was to do with javadoc comments
this is an issue with editing XML code, so not a duplicate anyway
Comment 6 David Strupl 2010-12-08 18:31:58 UTC
*** Bug 192964 has been marked as a duplicate of this bug. ***
Comment 7 David Strupl 2010-12-09 14:29:59 UTC
Milo, should 
replaceAndRepaintViews(ViewBuilder.java:598)
be run in AWT EDT? Or just the repaint itself? Thanks a lot for looking at this.
Comment 8 David Strupl 2010-12-13 10:35:51 UTC
*** Bug 192840 has been marked as a duplicate of this bug. ***
Comment 9 Miloslav Metelka 2010-12-21 11:16:03 UTC
For a long time Component.repaint() used to be thread-safe see e.g. http://java.sun.com/products/jfc/tsc/articles/threads/threads1.html

With the latest changes to jdk7 and jdk6 update 22 it's no longer true due to repaint()'s call to getLocationOnScreen() which acquires AWT tree lock:

java.awt.Component.getLocationOnScreen(Component.java:1995)
javax.swing.SwingUtilities.convertPointToScreen(SwingUtilities.java:380)
javax.swing.SwingUtilities.convertPoint(SwingUtilities.java:182)
javax.swing.SwingUtilities.convertRectangle(SwingUtilities.java:219)
javax.swing.RepaintManager.addDirtyRegion(RepaintManager.java:455)
javax.swing.JComponent.repaint(JComponent.java:4791)
java.awt.Component.repaint(Component.java:3264)

This causes deadlocks. Even in JDK's code itself - the JEditorPane.PageLoader may get deadlocked in the same way.

Since painting code executed in EDT first acquires AWT-treelock and then some Monitor2/Lock2 (e.g. document's read-lock etc.) we need to eliminate any call to repaint() in any thread that would first acquire Monitor2/Lock2.
So IMHO mostly we will wrap repaint()'s call with SwingUtilities.invokeLater() where possible.
Comment 10 Miloslav Metelka 2010-12-21 13:37:21 UTC
http://hg.netbeans.org/jet-main/rev/7aeb7cd8f1d0
Comment 11 Jan Becicka 2010-12-21 14:27:03 UTC
*** Bug 193267 has been marked as a duplicate of this bug. ***
Comment 12 Miloslav Metelka 2010-12-21 15:18:47 UTC
*** Bug 192643 has been marked as a duplicate of this bug. ***
Comment 13 Quality Engineering 2010-12-23 07:04:53 UTC
Integrated into 'main-golden', will be available in build *201012230001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/7aeb7cd8f1d0
User: Miloslav Metelka <mmetelka@netbeans.org>
Log: #192548 - Netbeans 7 locking up when opening some source code - JComponent.repaint() is no longer thread-safe.
Comment 14 Antonin Nebuzelsky 2010-12-23 12:03:00 UTC
*** Bug 193734 has been marked as a duplicate of this bug. ***
Comment 15 Marian Mirilovic 2011-03-05 14:01:56 UTC
*** Bug 196174 has been marked as a duplicate of this bug. ***