Bug 26077 - Eclipse hangs while building as a part of auto build for a ant script
Summary: Eclipse hangs while building as a part of auto build for a ant script
Status: RESOLVED WORKSFORME
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Ant (show other bugs)
Version: 2.0.1   Edit
Hardware: PC Windows NT
: P3 critical (vote)
Target Milestone: ---   Edit
Assignee: Platform-Ant-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: ui
Depends on:
Blocks:
 
Reported: 2002-11-13 01:29 EST by hitendrab CLA
Modified: 2002-11-19 10:17 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description hitendrab CLA 2002-11-13 01:29:41 EST
I am facing a strange problem, Eclipse hangs while building as a part of
 auto build. For this I am using exnternal tool. I have got a build.xml
 where I have written all compiler steps, and I have changed same .project
 file also to invoke my build tool only. For build or rebuild of a project
 goes smooth and I do not have any problem. But during auto build (when
 you change a source file & save), it hangs.
 
 I noticed that in both scenario it uses different Monitor
 (IProgressMonitor)
 1. For build/rebuild - DialogProgressMonitor
 2. For autobuild - EventLoopProgressMonitor
 
 It looks like that there is something wrong with EventLoopProgressMonitor,
 I guess thread are not closed, and wiat for ever.
 
 Please find the .project and build.xml file.
 
 <?xml version="1.0" encoding="UTF-8"?
 <projectDescription>
 <nameTest</name>
 <comment</comment>
 <projects>
 </projects>
 <buildSpec>
 <buildCommand>
 <nameorg.eclipse.ui.externaltools.ExternalToolBuilder</name>
 <arguments>
 <dictionary>
 <key!{tool_args}</key>
 <value</value>
 </dictionary>
 <dictionary>
 <key!{tool_loc}</key>
 <value${workspace_loc:/Test/build.xml}</value>
 </dictionary>
 <dictionary>
 <key!{tool_dir}</key>
 <value</value>
 </dictionary>
 <dictionary>
 <key!{tool_refresh}</key>
 <value${none}</value>
 </dictionary>
 <dictionary>
 <key!{tool_name}</key>
 <valueext</value>
 </dictionary>
 <dictionary>
 <key!{tool_type}</key>
 <valueorg.eclipse.ui.externaltools.type.ant</value>
 </dictionary>
 <dictionary>
 <key!{tool_show_log}</key>
 <valuetrue</value>
 </dictionary>
 </arguments>
 </buildCommand>
 </buildSpec>
 <natures>
 <natureorg.eclipse.jdt.core.javanature</nature>
 </natures>
 </projectDescription>
 
 
 <?xml version="1.0" encoding="UTF-8"?>
 <project name="test" default="compile" basedir=".">
   <target name="compile" >
     <exec dir="." executable="javac" >
       <arg line=" xyz.java" />
     </exec>
   </target>
 </project>
Comment 1 hitendrab CLA 2002-11-13 01:33:29 EST
After blocking the EventLoopProgressMonitor ( monitor.cancel(true), and
monitor.done()), and created new DialogProgressMonitor for building, and
it goes fine.
Comment 2 Darin Swanson CLA 2002-11-13 07:13:00 EST
We had problems with hanging in 2.0.1...is it possible for you to try 2.0.2. A 
fix was introduced and it would be great if you could see if this addresses 
your problem.  See bug 25191.
Comment 3 Darin Wright CLA 2002-11-15 21:15:17 EST
marking as "new" until we have verification this is still a problem.
Comment 4 hitendrab CLA 2002-11-16 00:50:18 EST
We tried with Eclipse 2.0.2, and it is working fine if I commnet
//monitor.isCanceled(); (blocking cancel functionality).
If you will use this, it throws error,
SWT.thread error...

We are looking for this solution where user can cancel operation anytime.
This fix was not made till now. Is there any work around to achieve this?
Comment 5 Darin Swanson CLA 2002-11-17 22:02:47 EST
So you are now getting an SWT error?
Can you provide the stack trace?
Comment 6 hitendrab CLA 2002-11-18 01:30:46 EST
Please find the stacktrace...
 
org.eclipse.swt.SWTException: Invalid thread access
	at org.eclipse.swt.SWT.error(SWT.java:2119)
	at org.eclipse.swt.SWT.error(SWT.java:2051)
	at org.eclipse.swt.widgets.Display.error(Display.java:503)
	at org.eclipse.swt.widgets.Display.checkDevice(Display.java:370)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1285)
	at org.eclipse.ui.internal.dialogs.EventLoopProgressMonitor.runEventLoop
(EventLoopProgressMonitor.java:89)
	at org.eclipse.ui.internal.dialogs.EventLoopProgressMonitor.isCanceled
(EventLoopProgressMonitor.java:68)
	at org.eclipse.core.runtime.ProgressMonitorWrapper.isCanceled
(ProgressMonitorWrapper.java:87)
	at org.eclipse.core.runtime.ProgressMonitorWrapper.isCanceled
(ProgressMonitorWrapper.java:87)
	at org.eclipse.core.runtime.ProgressMonitorWrapper.isCanceled
(ProgressMonitorWrapper.java:87)
	at test.BuildLogger.checkCanceled(BuildLogger.java:354)
	at test.ant.BuildLogger.messageLogged(BuildLogger.java:217)
	at org.apache.tools.ant.Project.fireMessageLoggedEvent(Project.java:982)
	at org.apache.tools.ant.Project.fireMessageLogged(Project.java:998)
	at org.apache.tools.ant.Project.log(Project.java:250)
	at org.apache.tools.ant.Task.log(Task.java:207)
	at org.apache.tools.ant.taskdefs.LogOutputStream.processLine
(LogOutputStream.java:132)
	at org.apache.tools.ant.taskdefs.LogOutputStream.processLine
(LogOutputStream.java:123)
	at org.apache.tools.ant.taskdefs.LogOutputStream.processBuffer
(LogOutputStream.java:113)
	at org.apache.tools.ant.taskdefs.LogOutputStream.write
(LogOutputStream.java:103)
	at java.io.OutputStream.write(OutputStream.java:102)
	at org.apache.tools.ant.taskdefs.StreamPumper.run(StreamPumper.java:100)
	at java.lang.Thread.run(Thread.java:484)
Comment 7 Darin Swanson CLA 2002-11-18 08:26:05 EST
The SWT error is an error in your code.  SWT enforces that all access to its 
widgets/state be only from the designated UI thread.  The coding style to 
workaround this limitation is to make use of Display.asyncExec(Runnable) and 
Display.syncExec(Runnable). See the comments on these methods for more details 
(or some of the many SWT snippet examples)
Comment 8 hitendrab CLA 2002-11-19 06:34:37 EST
After doing above change it works fine without any problem. 
Comment 9 Darin Swanson CLA 2002-11-19 10:17:03 EST
Fixed in 2.0.2.
No plans for any additional work.