Bug 230528 - Threading problems in Nimbus l&f
Threading problems in Nimbus l&f
Status: NEW
Product: platform
Classification: Unclassified
Component: -- Other --
7.4
All All
: P2 with 6 votes (vote)
: 8.0
Assigned To: Stanislav Aubrecht
issues@platform
: 8.1_WAIVER_APPROVED, UMBRELLA
: 226531 226902 229752 230584 232786 233857 234151 235427 235837 238425 241061 242433 242683 248792 248795 258779 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-05-30 13:07 UTC by Stanislav Aubrecht
Modified: 2016-07-28 10:57 UTC (History)
17 users (show)

See Also:
Issue Type: DEFECT
:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stanislav Aubrecht 2013-05-30 13:07:33 UTC
Because Nimbus look and feel isn't thread safe there are random exceptions when UI components are instantiated outside the EDT thread.
Comment 1 Stanislav Aubrecht 2013-08-21 09:31:24 UTC
*** Bug 234151 has been marked as a duplicate of this bug. ***
Comment 2 Stanislav Aubrecht 2013-08-21 09:31:36 UTC
*** Bug 233857 has been marked as a duplicate of this bug. ***
Comment 3 Stanislav Aubrecht 2013-08-21 09:31:54 UTC
*** Bug 232786 has been marked as a duplicate of this bug. ***
Comment 4 Stanislav Aubrecht 2013-08-21 09:32:01 UTC
*** Bug 230584 has been marked as a duplicate of this bug. ***
Comment 5 Stanislav Aubrecht 2013-08-21 09:32:19 UTC
*** Bug 229752 has been marked as a duplicate of this bug. ***
Comment 6 Stanislav Aubrecht 2013-08-21 09:32:30 UTC
*** Bug 226902 has been marked as a duplicate of this bug. ***
Comment 7 Stanislav Aubrecht 2013-08-21 09:32:44 UTC
*** Bug 226531 has been marked as a duplicate of this bug. ***
Comment 8 Stanislav Aubrecht 2013-09-03 07:25:02 UTC
*** Bug 235427 has been marked as a duplicate of this bug. ***
Comment 9 Stanislav Aubrecht 2013-09-12 07:21:22 UTC
*** Bug 235837 has been marked as a duplicate of this bug. ***
Comment 10 Stanislav Aubrecht 2013-12-02 13:55:40 UTC
*** Bug 238425 has been marked as a duplicate of this bug. ***
Comment 11 Stanislav Aubrecht 2014-01-28 13:30:53 UTC
*** Bug 241061 has been marked as a duplicate of this bug. ***
Comment 12 Stanislav Aubrecht 2014-03-03 14:01:52 UTC
*** Bug 242433 has been marked as a duplicate of this bug. ***
Comment 13 Ondrej Vrabec 2014-03-10 08:11:13 UTC
*** Bug 242683 has been marked as a duplicate of this bug. ***
Comment 14 Stanislav Aubrecht 2014-11-21 12:29:32 UTC
*** Bug 248795 has been marked as a duplicate of this bug. ***
Comment 15 cezariusz 2014-11-21 12:41:46 UTC
This issue has 14 duplicates, so according to http://wiki.netbeans.org/BugPriorityGuidelines it's P2.
Comment 16 cezariusz 2015-03-31 15:36:35 UTC
*** Bug 248792 has been marked as a duplicate of this bug. ***
Comment 17 cezariusz 2015-05-29 04:40:32 UTC
Sample exception which occurs quite often with Nimbus:

java.lang.NullPointerException
	at javax.swing.plaf.nimbus.NimbusStyle.validate(NimbusStyle.java:298)
	at javax.swing.plaf.nimbus.NimbusStyle.getValues(NimbusStyle.java:806)
	at javax.swing.plaf.nimbus.NimbusStyle.getInsets(NimbusStyle.java:485)
	at javax.swing.plaf.synth.SynthStyle.installDefaults(SynthStyle.java:913)
	at javax.swing.plaf.synth.SynthLookAndFeel.updateStyle(SynthLookAndFeel.java:265)
	at javax.swing.plaf.synth.SynthMenuItemUI.updateStyle(SynthMenuItemUI.java:96)
	at javax.swing.plaf.synth.SynthMenuItemUI.installDefaults(SynthMenuItemUI.java:80)
	at javax.swing.plaf.basic.BasicMenuItemUI.installUI(BasicMenuItemUI.java:107)
	at javax.swing.JComponent.setUI(JComponent.java:663)
	at javax.swing.AbstractButton.setUI(AbstractButton.java:1810)
	at javax.swing.JMenuItem.setUI(JMenuItem.java:241)
	at javax.swing.JMenuItem.updateUI(JMenuItem.java:250)
	at javax.swing.JMenuItem.init(JMenuItem.java:212)
	at javax.swing.JMenuItem.<init>(JMenuItem.java:151)
	at javax.swing.JMenuItem.<init>(JMenuItem.java:110)
	at org.openide.awt.Actions$MenuItem.<init>(Actions.java:1561)
	at org.netbeans.modules.openide.awt.DefaultAWTBridge.createMenuPresenter(DefaultAWTBridge.java:76)
	at org.openide.util.actions.CallableSystemAction.getMenuPresenter(CallableSystemAction.java:92)
	at org.openide.awt.DynaMenuModel.loadSubmenu(DynaMenuModel.java:101)
	at org.openide.awt.MenuBar$LazyMenu$MenuFolder.createInstance(MenuBar.java:808)
	at org.openide.loaders.FolderInstance.defaultProcessObjectsFinal(FolderInstance.java:888)
	at org.openide.loaders.FolderInstance$1R.run(FolderInstance.java:730)
	at org.openide.util.Task.run(Task.java:257)
[catch] at org.netbeans.modules.openide.loaders.AWTTask.run(AWTTask.java:79)
	at org.netbeans.modules.openide.loaders.AWTTask$Processor.run(AWTTask.java:172)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:744)
	at java.awt.EventQueue.access$400(EventQueue.java:97)
	at java.awt.EventQueue$3.run(EventQueue.java:697)
	at java.awt.EventQueue$3.run(EventQueue.java:691)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:714)
	at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:159)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Comment 18 cezariusz 2015-05-29 04:43:31 UTC
Another one:

java.lang.NullPointerException
	at javax.swing.plaf.nimbus.NimbusStyle.validate(NimbusStyle.java:298)
	at javax.swing.plaf.nimbus.NimbusStyle.getValues(NimbusStyle.java:806)
	at javax.swing.plaf.nimbus.NimbusStyle.getInsets(NimbusStyle.java:485)
	at javax.swing.plaf.synth.SynthStyle.installDefaults(SynthStyle.java:913)
	at javax.swing.plaf.synth.SynthLookAndFeel.updateStyle(SynthLookAndFeel.java:265)
	at javax.swing.plaf.synth.SynthProgressBarUI.updateStyle(SynthProgressBarUI.java:92)
	at javax.swing.plaf.synth.SynthProgressBarUI.installDefaults(SynthProgressBarUI.java:86)
	at javax.swing.plaf.basic.BasicProgressBarUI.installUI(BasicProgressBarUI.java:137)
	at javax.swing.JComponent.setUI(JComponent.java:666)
	at javax.swing.JProgressBar.setUI(JProgressBar.java:609)
	at javax.swing.JProgressBar.updateUI(JProgressBar.java:619)
	at javax.swing.JProgressBar.<init>(JProgressBar.java:334)
	at javax.swing.JProgressBar.<init>(JProgressBar.java:274)
	at javax.swing.JProgressBar.<init>(JProgressBar.java:251)
	at org.netbeans.modules.progress.ui.NbProgressBar.<init>(NbProgressBar.java:74)
	at org.netbeans.modules.progress.ui.StatusLineComponent.createBar(StatusLineComponent.java:185)
	at org.netbeans.modules.progress.ui.StatusLineComponent.<init>(StatusLineComponent.java:132)
	at org.netbeans.modules.progress.ui.ProviderImpl.getDefaultWorker(ProviderImpl.java:63)
	at org.netbeans.modules.progress.spi.Controller.getProgressUIWorker(Controller.java:125)
	at org.netbeans.modules.progress.spi.Controller.getVisualComponent(Controller.java:108)
	at org.netbeans.progress.module.ProgressVisualizerProvider.getStatusLineElement(ProgressVisualizerProvider.java:60)
	at org.netbeans.core.windows.view.ui.MainWindow$7.run(MainWindow.java:405)
	at org.netbeans.core.windows.view.ui.MainWindow.getStatusLineElements(MainWindow.java:417)
	at org.netbeans.core.windows.view.ui.MainWindow.decoratePanel(MainWindow.java:371)
	at org.netbeans.core.windows.view.ui.MainWindow.access$100(MainWindow.java:81)
	at org.netbeans.core.windows.view.ui.MainWindow$2.run(MainWindow.java:269)
[catch] at org.netbeans.core.windows.WindowManagerImpl$Exclusive$1.run(WindowManagerImpl.java:1563)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:749)
	at java.awt.EventQueue.access$500(EventQueue.java:97)
	at java.awt.EventQueue$3.run(EventQueue.java:702)
	at java.awt.EventQueue$3.run(EventQueue.java:696)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:719)
	at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:159)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Comment 19 Theofanis Oikonomou 2015-09-29 07:54:06 UTC
This is out of scope for 8.1 release...
Comment 20 Jiri Kovalsky 2015-09-29 11:58:29 UTC
As per the bug waiving process [1] can you please provide appropriate justification for the waiver request? Why the bug cannot be fixed for 8.1? What is the plan about it? We know about this issue for 28 months already. Thanks Fanis!

[1] http://wiki.netbeans.org/WaiverProcess
Comment 21 Martin Entlicher 2015-09-30 16:42:25 UTC
According to the reports, this might be an issue on JDK 7 only. There are no reports from JDK 8. Can someone confirm please?
Comment 22 Theofanis Oikonomou 2015-10-01 14:18:20 UTC
(In reply to Jiri Kovalsky from comment #20)
> As per the bug waiving process [1] can you please provide appropriate
> justification for the waiver request? Why the bug cannot be fixed for 8.1?
> What is the plan about it? We know about this issue for 28 months already.
> Thanks Fanis!
> 
> [1] http://wiki.netbeans.org/WaiverProcess

Well, it seems that this bug most probably is due to issue in Nimbus and/or jdk, which since all the duplicates are from users with jdk7, might mean that it got fixed in Nimbus and/or jdk side. There are no reports from users with jdk8 AFAICT. From the stack-traces it seems that the exception is coming from awt code. I am not sure where the issue might be in netbeans side, if indeed it is an issue with netbeans code in the first place. So, trying a fix this late is IMHO out of scope for this release. Thank you.
Comment 23 attila.kelemen 2015-10-01 14:31:59 UTC
I have seen bugs like this in other projects and I find it very likely that this is a bug in NetBeans. That is, regardless of where the exception is thrown these kind of "ClassCastException"s were always caused by misusing Swing in my experience. However, pinpointing the cause in the NetBeans codebase seems close to impossible. The only way I see is to check all places where Swing components are created and/or accessed (which thread) and fix those places (this is quite a big task given how big the code base of NB is). Not to mention that third party plugins might be a cause for this as well.

That it works with JDK 8 can be considered a coincidence (in my opinion). Though, I wouldn't be surprised that the JDK developers made some effort to avoid errors when the Swing components are misused.
Comment 24 matvei 2015-10-02 23:50:16 UTC
I have seen these exact exceptions in my own NetBeans RCP-based application, and the culprits were often Actions that try to create or interact with Swing components from their constructors. Because NetBeans RCP typically constructs registered Actions off the EDT, this causes multiple threads to interact with Swing/Nimbus L&F concurrently.

Altering these Actions to not interact with Swing at construction time (e.g. switching to lazy initialization or by using SwingUtilities.invokeLater(...)) has always fixed these exceptions for me.

Perhaps there are some Actions in NetBeans RCP or IDE that have the same problem?
Comment 25 Jiri Kovalsky 2015-10-05 11:17:38 UTC
Bug waiver for 8.1 approved.
Comment 26 Jiri Prox 2016-04-21 22:42:19 UTC
*** Bug 258779 has been marked as a duplicate of this bug. ***
Comment 27 phansson 2016-07-28 10:57:23 UTC
I find this interesting:  http://bugs.java.com/view_bug.do?bug_id=6718641

It says that

"This is not expected to work since about 2003. The rules for threading in Swing were changed to say that all object contruction must be done on the event dispatching thread (EDT). Prior to then object contruction was allowed before the top level(Frame) was realised, but that is no longer the case. Almost all code in Swing assumes it is running on the EDT in a single threaded model, Nimbus LAF is no different. There is documented in the Swing Tutorial at http://java.sun.com/docs/books/tutorial/uiswing/concurrency/initial.html"


In other words: It may be that Nimbus is more sensible to misuse from outside the EDT than are other L&Fs, but that is the symptom of the problem not the cause. The cause is the misuse.


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo