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 221034 - Asynch shutDown proposal - IDE hangs on exit with any onStop tasks doing AWT access
Summary: Asynch shutDown proposal - IDE hangs on exit with any onStop tasks doing AWT ...
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Module System (show other bugs)
Version: 7.2
Hardware: All All
: P2 normal (vote)
Assignee: Jaroslav Tulach
URL:
Keywords: API_REVIEW_FAST
: 217317 220817 221636 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-10-29 15:06 UTC by Vladimir Voskresensky
Modified: 2012-11-15 02:47 UTC (History)
7 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Review (48.84 KB, patch)
2012-11-05 10:51 UTC, Jaroslav Tulach
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir Voskresensky 2012-10-29 15:06:40 UTC
extracted as separate problem from issue #217317

Do to NbInstaller.close which is run in EDT and loop
        for (Task t : waitFor) {
            t.waitFinished();
        }
at the end of method => any onStop task which uses EDT can not run => close can not finish
Comment 1 Vladimir Voskresensky 2012-10-29 15:17:52 UTC
"AWT-EventQueue-1" prio=3 tid=0x0b451000 nid=0x24 in Object.wait() [0x5b7fe000]
   java.lang.Thread.State: WAITING (on object monitor)
        at java.lang.Object.wait(Native Method)
        - waiting on <0xe7822648> (a org.openide.util.RequestProcessor$Task)
        at java.lang.Object.wait(Object.java:485)
        at org.openide.util.Task.waitFinished(Task.java:135)
        - locked <0xe7822648> (a org.openide.util.RequestProcessor$Task)
        at org.openide.util.RequestProcessor$Task.waitFinished(RequestProcessor.java:1710)
        at org.netbeans.core.startup.NbInstaller.close(NbInstaller.java:742)
        at org.netbeans.ModuleManager.shutDown(ModuleManager.java:1947)
        at org.netbeans.core.startup.ModuleSystem.shutDown(ModuleSystem.java:322)
        at org.netbeans.core.NbLifecycleManager.doExit(NbLifecycleManager.java:179)
        at org.netbeans.core.NbLifecycleManager.access$000(NbLifecycleManager.java:75)
        at org.netbeans.core.NbLifecycleManager$ExitActions.run(NbLifecycleManager.java:135)
        at org.openide.util.Mutex.doEvent(Mutex.java:1343)
        at org.openide.util.Mutex.readAccess(Mutex.java:350)
        at org.netbeans.core.NbLifecycleManager.exit(NbLifecycleManager.java:111)
        at org.netbeans.core.windows.view.ui.MainWindow$6.windowClosing(MainWindow.java:479)
        at java.awt.AWTEventMulticaster.windowClosing(AWTEventMulticaster.java:332)
        at java.awt.AWTEventMulticaster.windowClosing(AWTEventMulticaster.java:332)
        at java.awt.Window.processWindowEvent(Window.java:1871)
        at javax.swing.JFrame.processWindowEvent(JFrame.java:274)
        at java.awt.Window.processEvent(Window.java:1829)
        at java.awt.Component.dispatchEventImpl(Component.java:4660)
        at java.awt.Container.dispatchEventImpl(Container.java:2097)
        at java.awt.Window.dispatchEventImpl(Window.java:2489)
        at java.awt.Component.dispatchEvent(Component.java:4488)
        at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:668)
        at java.awt.EventQueue.access$400(EventQueue.java:81)
        at java.awt.EventQueue$2.run(EventQueue.java:627)
        at java.awt.EventQueue$2.run(EventQueue.java:625)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
        at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:98)
        at java.awt.EventQueue$3.run(EventQueue.java:641)
        at java.awt.EventQueue$3.run(EventQueue.java:639)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:638)
        at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:158)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
"On Start/Stop" daemon prio=3 tid=0x0affe000 nid=0x86 in Object.wait() [0x57dff000]
   java.lang.Thread.State: WAITING (on object monitor)
        at java.lang.Object.wait(Native Method)
        - waiting on <0xe7779408> (a java.awt.EventQueue$1AWTInvocationLock)
        at java.lang.Object.wait(Object.java:485)
        at java.awt.EventQueue.invokeAndWait(EventQueue.java:1070)
        - locked <0xe7779408> (a java.awt.EventQueue$1AWTInvocationLock)
        at org.openide.util.Mutex.doEventAccess(Mutex.java:1396)
        at org.openide.util.Mutex.readAccess(Mutex.java:273)
        at org.netbeans.core.windows.services.DialogDisplayerImpl.createDialog(DialogDisplayerImpl.java:116)
        at org.netbeans.core.execution.Install.showPendingTasks(Install.java:271)
        at org.netbeans.core.execution.Install.access$000(Install.java:111)
        at org.netbeans.core.execution.Install$Down.run(Install.java:136)
        at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1454)
        at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2036)
Comment 2 Jaroslav Tulach 2012-11-05 10:51:28 UTC
Created attachment 127131 [details]
Review
Comment 3 Jaroslav Tulach 2012-11-05 10:52:57 UTC
*** Bug 217317 has been marked as a duplicate of this bug. ***
Comment 4 Vladimir Voskresensky 2012-11-06 13:22:59 UTC
VV01: ProxyTask has a sync window which can lead to never reached 'cnt==0' condition.
Constructor takes already running tasks => 
this.cnt = waitFor.size();
and loop with
t.addTaskListener(this);
are not atomic => tasks can be already finished => taskFinished will not be called for already finished ones => cnt can not reach zero
Comment 5 Jaroslav Tulach 2012-11-06 15:54:59 UTC
(In reply to comment #4)
> tasks can be already finished => taskFinished will not be
> called for already finished ones

Actually it should be called. The in case one add TaskListener to already finished task, the callback is called immediately. I've documented the existing behaviour in ergonomics#fef258ff2339
Comment 6 Ondrej Vrabec 2012-11-06 15:58:20 UTC
*** Bug 220817 has been marked as a duplicate of this bug. ***
Comment 7 Petr Cyhelsky 2012-11-07 15:04:29 UTC
*** Bug 221636 has been marked as a duplicate of this bug. ***
Comment 8 Quality Engineering 2012-11-08 02:53:23 UTC
Integrated into 'main-golden', will be available in build *201211080001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/cb998950be80
User: Jaroslav Tulach <jtulach@netbeans.org>
Log: #221034: Adding @RandomlyFails until that bug is fixed
Comment 9 Jaroslav Tulach 2012-11-09 08:16:37 UTC
Unless there are other comments, I'll integrate in few days.
Comment 10 Jaroslav Tulach 2012-11-13 07:28:22 UTC
ergonomics#4be73336bebf
Comment 11 Quality Engineering 2012-11-15 02:47:48 UTC
Integrated into 'main-golden', will be available in build *201211150001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/4be73336bebf
User: Jaroslav Tulach <jtulach@netbeans.org>
Log: #221034: Support for asynchronous shutdown