Bug 489524 - First load of the Ant view takes very long.
Summary: First load of the Ant view takes very long.
Status: RESOLVED WORKSFORME
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Ant (show other bugs)
Version: 4.6   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Sarika Sinha CLA
QA Contact:
URL:
Whiteboard:
Keywords: needinfo
Depends on:
Blocks:
 
Reported: 2016-03-14 05:11 EDT by Robert Zenz CLA
Modified: 2017-12-05 11:25 EST (History)
2 users (show)

See Also:


Attachments
Threaddump taken when adding a build file to the Ant view. (24.93 KB, application/octet-stream)
2016-04-11 06:33 EDT, Robert Zenz CLA
no flags Details
Threaddump taken when adding a build file to the Ant view. (25.39 KB, text/plain)
2016-04-11 06:34 EDT, Robert Zenz CLA
no flags Details
Threaddump taken during startup of Eclipse with a populated Ant view. (33.89 KB, text/plain)
2016-04-11 06:34 EDT, Robert Zenz CLA
no flags Details
Threaddump taken during startup of Eclipse with a populated Ant view. (34.41 KB, text/plain)
2016-04-11 06:35 EDT, Robert Zenz CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Zenz CLA 2016-03-14 05:11:42 EDT
The Ant view is very slow upon first/initial load (during the start of Eclipse or if the Ant view is displayed the first time). This gets worse the more build files are added.

The added build files are between 25k and 60k bytes, most of them can be found in the JVx project: https://sourceforge.net/projects/jvx/ .

Sorry for the sparse information, I am happy to provide more information, but I don't know what exactly you need to know.
Comment 1 Dani Megert CLA 2016-04-05 09:31:15 EDT
The Ant view opens immediately for me using
http://download.eclipse.org/eclipse/downloads/drops4/S-4.6M6-201603170200/

Can you still see this with above build, or a newer one?

If so, please make some stack traces and attach them here. For details see
https://wiki.eclipse.org/How_to_report_a_deadlock#Getting_a_stack_trace_on_Windows
Comment 2 Robert Zenz CLA 2016-04-11 04:00:25 EDT
Yes, I'm still seeing this in the specified build.

When I add the build files from the JVx family I'm looking at a load time of 40+ seconds for the Ant view. The worst offender is the build file from the JVx.help project (https://sourceforge.net/projects/jvxonlinehelp/), which itself takes 20+ seconds to load in the Ant view.

I do not believe that it is a deadlock, it returns "after some time" and I could not detect a deadlock in jconsole. I additionally looked at Eclipse with jvisualvm and I could neither see a lot of CU, memory or GC activity. What I did see, though, is that a lot of time is spent in the following methods:

 org.apache.tools.ant.taskdefs.condition.Socket.eval()
 org.apache.tools.ant.taskdefs.condition.Http.eval()

With (most) build files containing (with the "x" being placeholders):

  <target name="proxy.check">
    <condition property="proxy.enabled">
      <and>
        <socket server="x.x.x.x" port="xxxx"/>
      </and>
    </condition>
  </target>
  
  <target name="proxy" depends="proxy.check" if="proxy.enabled">
    <property name="proxy.host" value="x.x.x.x"/>
    <property name="proxy.port" value="x"/>
    <property name="proxy.user" value=""/>
    <property name="proxy.pass" value=""/>
      
    <setproxy proxyhost="${proxy.host}" proxyport="${proxy.port}" proxyuser="${proxy.user}" proxypassword="${proxy.password}"/>
  </target>

So from what I can gather is that the Ant view is, in one way or another, evaluating the different targets and triggers the proxy check. That leads to the slowdown, because the proxy does not work from the machine at which I'm sitting.

Ahrm, okay, from here I'm uncertain if this is an Eclipse bug *at all*. Ideally the Ant view would not execute anything in the build file but rather just parse it to get the target names, but I do not know enough about the internals of Ant, the Ant view or Eclipse to make a profound statement about this.
Comment 3 Dani Megert CLA 2016-04-11 06:20:15 EDT
Robert, please provide the stack traces as per comment 1.
Comment 4 Robert Zenz CLA 2016-04-11 06:33:45 EDT
Created attachment 260843 [details]
Threaddump taken when adding a build file to the Ant view.
Comment 5 Robert Zenz CLA 2016-04-11 06:34:14 EDT
Created attachment 260844 [details]
Threaddump taken when adding a build file to the Ant view.
Comment 6 Robert Zenz CLA 2016-04-11 06:34:54 EDT
Created attachment 260845 [details]
Threaddump taken during startup of Eclipse with a populated Ant view.
Comment 7 Robert Zenz CLA 2016-04-11 06:35:13 EDT
Created attachment 260846 [details]
Threaddump taken during startup of Eclipse with a populated Ant view.
Comment 8 Dani Megert CLA 2016-04-11 06:37:15 EDT
Sarika, please have a look.
Comment 9 Robert Zenz CLA 2016-04-11 06:37:45 EDT
I've attached a few threaddumps.

"Adding" was taken when adding a build file to the Ant view.

"Starting" was taken when Eclipse is starting (with build files added to the Ant view and the Ant view by default visible in the perspective).

All four threaddumps were taken while Eclipse was frozen for 10+ seconds.
Comment 10 Sarika Sinha CLA 2016-04-11 14:15:48 EDT
Thanks Robert for providing the dumps, I will be looking at them.
Comment 11 Dani Megert CLA 2017-12-05 11:25:39 EST
This works for me using http://download.eclipse.org/eclipse/downloads/drops4/S-4.8M3a-201710300400/

If you still see this, please reopen with detailed steps.