Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 312318

Summary: RemoveModuleAction causes UI hang - ServerWorkingCopy.save() called on UI thread
Product: [WebTools] WTP ServerTools Reporter: Elson Yuen <eyuen7>
Component: wst.serverAssignee: Elson Yuen <eyuen7>
Status: RESOLVED FIXED QA Contact: Angel Vera <arvera>
Severity: normal    
Priority: P3 CC: neil.hauge
Version: unspecifiedFlags: arvera: pmc_approved? (david_williams)
arvera: pmc_approved? (raghunathan.srinivasan)
arvera: pmc_approved? (naci.dai)
arvera: pmc_approved? (deboer)
neil.hauge: pmc_approved+
arvera: pmc_approved? (kaloyan)
arvera: review+
Target Milestone: 3.2 RC1   
Hardware: PC   
OS: Windows XP   
See Also: https://git.eclipse.org/r/108952
Whiteboard: PMC_approved
Attachments:
Description Flags
v1.0 eyuen7: review?

Description Elson Yuen CLA 2010-05-10 14:32:01 EDT
Build Identifier: WTP 3.2

I removed a module from my server and the UI hung as a result. It eventually returned, but I took a thread dump and it showed the main thread busy in a stack trace that started in RemoveModuleAction#run.

          at org/eclipse/ui/internal/console/IOConsolePartitioner.processQueue(IOConsolePartitioner.java:553(Compiled Code))
          at org/eclipse/ui/internal/console/IOConsolePartitioner$QueueProcessingJob.runInUIThread(IOConsolePartitioner.java:514)
          at org/eclipse/ui/progress/UIJob$1.run(UIJob.java:94(Compiled Code))
          at org/eclipse/swt/widgets/RunnableLock.run(RunnableLock.java:35(Compiled Code))
          at org/eclipse/swt/widgets/Synchronizer.runAsyncMessages(Synchronizer.java:129(Compiled Code))
          at org/eclipse/swt/widgets/Display.runAsyncMessages(Display.java(Compiled Code))
          at org/eclipse/swt/widgets/Display.readAndDispatch(Display.java:3416(Compiled Code))
          at org/eclipse/ui/internal/dialogs/EventLoopProgressMonitor.runEventLoop(EventLoopProgressMonitor.java:123(Compiled Code))
          at org/eclipse/ui/internal/dialogs/EventLoopProgressMonitor.isCanceled(EventLoopProgressMonitor.java:97)
          at org/eclipse/core/internal/jobs/ThreadJob.isCanceled(ThreadJob.java:132(Compiled Code))
          at org/eclipse/core/internal/jobs/ThreadJob.joinRun(ThreadJob.java:167(Compiled Code))
          at org/eclipse/core/internal/jobs/ImplicitJobs.begin(ImplicitJobs.java:87(Compiled Code))
          at org/eclipse/core/internal/jobs/JobManager.beginRule(JobManager.java:230(Compiled Code))
          at org/eclipse/core/internal/resources/WorkManager.checkIn(WorkManager.java:114(Compiled Code))
          at org/eclipse/core/internal/resources/Workspace.prepareOperation(Workspace.java:1744(Compiled Code))
          at org/eclipse/core/internal/resources/File.setContents(File.java:364)
          at org/eclipse/core/internal/resources/File.setContents(File.java:469)
          at org/eclipse/wst/server/core/internal/Base.saveToFile(Base.java:251)
          at org/eclipse/wst/server/core/internal/Server.saveToFile(Server.java:408)
          at org/eclipse/wst/server/core/internal/Base.doSave(Base.java:262)
          at org/eclipse/wst/server/core/internal/Server.doSave(Server.java:403)
          at org/eclipse/wst/server/core/internal/ServerWorkingCopy.save(ServerWorkingCopy.java:421)
          at org/eclipse/wst/server/ui/internal/view/servers/RemoveModuleAction.run(RemoveModuleAction.java:54)

Reproducible: Always
Comment 1 Elson Yuen CLA 2010-05-10 14:32:30 EDT
Angel, please assign this one to me.
Comment 2 Elson Yuen CLA 2010-05-10 14:48:26 EDT
Created attachment 167780 [details]
v1.0

The fix is to move the server configuration save action to a cancelable progress monitor dialog to avoid the UI hang.
Comment 3 Angel Vera CLA 2010-05-12 09:50:09 EDT
* Explain why you believe this is a stop-ship defect. Or, if it is a "hotbug" (requested by an adopter) please document it as such. 
The current behaviour can cause a UI hangs that depending on the platform and the operations could be lengthy.

* Is there a work-around? If so, why do you believe the work-around is insufficient? 
The workaround is to wait until the UI becomes responsive again, this could be from immediate to a few seconds.

* How has the fix been tested? Is there a test case attached to the bugzilla record? Has a JUnit Test been added? 
Launched the affect wizard in several scenarios, also try to cancel the new added progress monitor.

* Give a brief technical overview. Who has reviewed this fix? 
The fix is to introduce a runnable with a progress monitor that will execute the lengthy action in a separate runnable.

Angel reviewed the fix. 

* What is the risk associated with this fix? 
Low to minimal
Comment 4 Angel Vera CLA 2010-05-12 16:51:33 EDT
changes committed to HEAD
Comment 5 Angel Vera CLA 2010-05-12 16:59:41 EDT
released to HEAD
Comment 6 Eclipse Genie CLA 2017-10-11 16:33:34 EDT
New Gerrit change created: https://git.eclipse.org/r/108952