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 37453

Summary: TopComponents opened from non-AWT thread cause deadlock
Product: obsolete Reporter: Martin Entlicher <mentlicher>
Component: vcscoreAssignee: Martin Entlicher <mentlicher>
Status: VERIFIED FIXED    
Severity: blocker    
Priority: P1    
Version: 3.x   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:
Attachments: The deadlock after PVCS -> Diff

Description Martin Entlicher 2003-11-24 15:24:45 UTC
In dev build #200311231900 when you do a graphical
diff, the IDE will deadlock.

Several exceptions will be thrown:
java.lang.IllegalStateException: This must happen
in the event thread!

This started to happen after changes in the window
system. It's necessary to go through the whole
codebase and:
1) Mark all actions that open GUI as not
   asychronous,
2) Find all places where TopComponents are opened
   and assure that this is done in AWT thread.
Comment 1 Martin Entlicher 2003-11-24 15:26:18 UTC
Created attachment 12273 [details]
The deadlock after PVCS -> Diff
Comment 2 Martin Entlicher 2003-11-24 15:27:51 UTC
This is really a critical issue, the VCS support is seriously broken.
Starting to work on it immediately...
Comment 3 Martin Entlicher 2003-11-24 16:01:15 UTC
This problem was already solved for several actions:

/cvs/vcscore/src/org/netbeans/modules/vcscore/actions/VersioningExplorerAction.java,v 
<--  VersioningExplorerAction.java
new revision: 1.12; previous revision: 1.10

/cvs/vcscore/src/org/netbeans/modules/vcscore/runtime/CommandOutputTextViewAction.java,v 
<--  CommandOutputTextViewAction.java
new revision: 1.4; previous revision: 1.2

/cvs/vcscore/src/org/netbeans/modules/vcscore/runtime/CommandOutputViewAction.java,v 
<--  CommandOutputViewAction.java
new revision: 1.9; previous revision: 1.7

http://vcscore.netbeans.org/source/browse/vcscore/src/org/netbeans/modules/vcscore/cmdline/UserCommandSupport.java.diff?r1=1.27&r2=1.28

Comment 4 Martin Entlicher 2003-11-24 17:41:01 UTC
Fixed for actions that extend CallableSystemAction and NodeAction:

/cvs/vcscore/src/org/netbeans/modules/vcscore/grouping/VcsGroupMenuAction.java,v 
<--  VcsGroupMenuAction.java
new revision: 1.16; previous revision: 1.15

/cvs/vcscore/src/org/netbeans/modules/vcscore/actions/VcsSettingsAction.java,v 
<--  VcsSettingsAction.java
new revision: 1.11; previous revision: 1.10

/cvs/vcscore/src/org/netbeans/modules/vcscore/annotation/AddVariableAction.java,v 
<--  AddVariableAction.java
new revision: 1.4; previous revision: 1.3

/cvs/vcscore/src/org/netbeans/modules/vcscore/annotation/AddIfDefinedAction.java,v 
<--  AddIfDefinedAction.java
new revision: 1.4; previous revision: 1.3

/cvs/vcscore/src/org/netbeans/modules/vcscore/annotation/AddTextAction.java,v 
<--  AddTextAction.java
new revision: 1.3; previous revision: 1.2

/cvs/vcscore/src/org/netbeans/modules/vcscore/runtime/KillRunningCommandAction.java,v 
<--  KillRunningCommandAction.java
new revision: 1.5; previous revision: 1.4

/cvs/vcscore/src/org/netbeans/modules/vcscore/actions/VcsMountFromTemplateAction.java,v 
<--  VcsMountFromTemplateAction.java
new revision: 1.17; previous revision: 1.16

/cvs/vcscore/src/org/netbeans/modules/vcscore/grouping/RemoveVcsGroupAction.java,v 
<--  RemoveVcsGroupAction.java
new revision: 1.9; previous revision: 1.8

/cvs/vcscore/src/org/netbeans/modules/vcscore/grouping/AddVcsGroupAction.java,v 
<--  AddVcsGroupAction.java
new revision: 1.9; previous revision: 1.8

/cvs/vcscore/src/org/netbeans/modules/vcscore/VcsRevisionAction.java,v 
<--  VcsRevisionAction.java
new revision: 1.6; previous revision: 1.5

Comment 5 Martin Entlicher 2003-11-24 18:17:17 UTC
GeneralCommandAction made synchronous (this have an impact on a bunch
of other actions that extends this one):

/cvs/vcscore/src/org/netbeans/modules/vcscore/actions/GeneralCommandAction.java,v 
<--  GeneralCommandAction.java
new revision: 1.21; previous revision: 1.20

/cvs/vcscore/src/org/netbeans/modules/vcscore/actions/CommandActionSupporter.java,v 
<--  CommandActionSupporter.java
new revision: 1.4; previous revision: 1.3
Comment 6 Martin Entlicher 2003-11-24 19:29:48 UTC
Fixed for VcsGeneric module (diff component must be opened in AWT):

/cvs/vcsgeneric/src/org/netbeans/modules/vcs/profiles/commands/AbstractDiffCommand.java,v 
<--  AbstractDiffCommand.java
new revision: 1.4; previous revision: 1.3

All profiles must be checked and also Diff module.
Comment 7 Martin Entlicher 2003-11-25 10:52:40 UTC
Fixed in diff module:

/cvs/diff/src/org/netbeans/modules/diff/DiffAction.java,v  <-- 
DiffAction.java
new revision: 1.16; previous revision: 1.15

/cvs/diff/src/org/netbeans/modules/diff/PatchAction.java,v  <-- 
PatchAction.java
new revision: 1.14; previous revision: 1.13
Comment 8 Martin Entlicher 2003-11-25 11:59:27 UTC
Fixed for conflict resolvers in CVS and PVCS profiles:

/cvs/vcsgeneric/profiles/cvsprofiles/src/org/netbeans/modules/vcs/profiles/cvsprofiles/commands/CvsResolveConflicts.java,v 
<--  CvsResolveConflicts.java
new revision: 1.11; previous revision: 1.10

/cvs/vcsgeneric/profiles/pvcs/src/org/netbeans/modules/vcs/profiles/pvcs/commands/PvcsResolveConflicts.java,v 
<--  PvcsResolveConflicts.java
new revision: 1.2; previous revision: 1.1

The problem is hopefully fixed everywhere (in VCS + Diff modules).
Comment 9 Martin Entlicher 2003-12-08 11:46:50 UTC
This problem was not fully fixed when calling methods on
TopComponents. There's still a problem with method calls outside of
AWT thread in build #200312071900:

[catch]java.lang.IllegalStateException: Assertion failed. WindowsAPI
is required to be called from AWT thread only, see
http://www.netbeans.org/download/dev/javadoc/OpenAPIs/org/openide/doc-files/threading.html
        at
org.netbeans.core.windows.WindowManagerImpl.assertEventDispatchThreadWeak(WindowManagerImpl.java:875)
        at
org.netbeans.core.windows.WindowManagerImpl.topComponentIconChanged(WindowManagerImpl.java:807)
        at
org.openide.windows.TopComponent.setIcon(TopComponent.java:558)
        at
org.netbeans.modules.vcscore.commands.CommandOutputVisualizer.<init>(CommandOutputVisualizer.java:72)
        at
org.netbeans.modules.vcscore.cmdline.UserCommandTask.getVisualizerText(UserCommandTask.java:358)
...

[catch]java.lang.IllegalStateException: Assertion failed. WindowsAPI
is required to be called from AWT thread only, see
http://www.netbeans.org/download/dev/javadoc/OpenAPIs/org/openide/doc-files/threading.html
        at
org.netbeans.core.windows.WindowManagerImpl.assertEventDispatchThreadWeak(WindowManagerImpl.java:875)
        at
org.netbeans.core.windows.WindowManagerImpl.topComponentDisplayNameChanged(WindowManagerImpl.java:789)
        at
org.openide.windows.TopComponent.setName(TopComponent.java:508)
        at
org.netbeans.modules.vcscore.commands.CommandOutputVisualizer.setVcsTask(CommandOutputVisualizer.java:123)
...

[catch]java.lang.IllegalStateException: Assertion failed. WindowsAPI
is required to be called from AWT thread only, see
http://www.netbeans.org/download/dev/javadoc/OpenAPIs/org/openide/doc-files/threading.html
        at
org.netbeans.core.windows.WindowManagerImpl.assertEventDispatchThreadWeak(WindowManagerImpl.java:875)
        at
org.netbeans.core.windows.WindowManagerImpl.topComponentDisplayNameChanged(WindowManagerImpl.java:789)
        at
org.openide.windows.TopComponent.setDisplayName(TopComponent.java:522)
        at
org.netbeans.modules.vcscore.commands.CommandOutputVisualizer.setVcsTask(CommandOutputVisualizer.java:141)
...


This problem is fixed in trunk:
/cvs/vcscore/src/org/netbeans/modules/vcscore/commands/CommandOutputVisualizer.java,v 
<--  CommandOutputVisualizer.java
new revision: 1.27; previous revision: 1.26
Comment 10 dmladek 2004-02-17 13:08:19 UTC
I believe it's fixed, No deadlocks since that related to this one