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

Bug 91525

Summary: [Intro] o.e.pde can not be jarred
Product: [Eclipse Project] Platform Reporter: Mazen Faraj <mfaraj>
Component: User AssistanceAssignee: Mazen Faraj <mfaraj>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: dj.houghton, jeffmcaffer, wassim.melhem
Version: 3.1   
Target Milestone: 3.1 M7   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Bug Depends on:    
Bug Blocks: 90086    

Description Mazen Faraj CLA 2005-04-15 10:03:48 EDT
please unjar o.e.pde plugin as it has Intro content and it can not be jarred.
Comment 1 Wassim Melhem CLA 2005-04-15 10:06:03 EDT
what is the technical limitation that prevents the jarring?
Comment 2 Mazen Faraj CLA 2005-04-15 10:22:40 EDT
Intro gathers content from various plugins and creates an HTML file in memory 
that is rendered in the SWT Browser. Relative resource that are used by CSS 
files can not be resolved in the case when these content plugins are jarred.
Hence the requirement. 
There is one thing that I want to convince myself with first (Im 
investigating), but for now, please unjar pde to prevent Intro from being 
broken.  
Comment 3 Wassim Melhem CLA 2005-04-15 11:33:18 EDT
Konrad, please reverse the jarring process for now.

Jeff, how does this limitation fit into the "jars are the path to Nirvana" 
theory?
Comment 4 Dejan Glozic CLA 2005-04-15 13:33:03 EDT
The following branding plug-ins:

org.eclipse.platform
org.eclipse.jdt
org.eclipse.pde

cannot be JARd because they contain web resources (css files, images etc.) 
that the generated welcome HTML pages reference. Embedded browsers we use do 
not understand jar protocol - we must have these resources on the file system.
Comment 5 Jeff McAffer CLA 2005-04-15 13:57:53 EDT
Note that we have the same problem with the About informatoin.  The approach 
there was to simply extract the files before launching the browser.  For 
example, 
    URL url = Platform.asLocalURL(bundle.getEntry("welcome_files/"));
    browser.open(url);
Extracts (if needed) all the files in welcome_files and then launches the 
browser on them.

Presumeably this is only needed if someone actually visits the welcome pages...
Comment 6 Dejan Glozic CLA 2005-04-15 14:03:52 EDT
True but welcome pages are loaded on first Eclipse startup (always), so 
unzipping the files adds to the overall startup time.
Comment 7 Jeff McAffer CLA 2005-04-15 14:19:15 EDT
The welcome support etc should use the coding pattern outlined to ensure that 
plugins contriubting intro/welcome content CAN be jard.  There is a separate 
question as to whether or not a particular plugin should be JARd.  For the 
Platform perhaps it should not.  Perhaps JDT etc can be jar'd.  
Comment 8 Dejan Glozic CLA 2005-04-15 14:23:46 EDT
Since these kinds of scenarios are not unique (i.e. inability to use resources 
in a JAR), will platform provide some helper methods/classes to unzip zip 
entries before use?
Comment 9 Dejan Glozic CLA 2005-04-15 14:25:50 EDT
Sorry, I can see that you already answered this in the comment #5.
Comment 10 Mazen Faraj CLA 2005-04-15 14:27:34 EDT
(In reply to comment #5)
Jeff,
Intro already loads each and every resource using the above trick. Because PDE 
does not behave like real runtime, there is a difference in behavior when 
testing. Let me explain: 
Each intro resource is loaded using Platform.find() + Platform.asLocalURL() + 
toExternalString(). When a plugin is not jarred, this returns the true 
location of the resource in the plugin. This means that relative resource are 
properly resolved.  When the plugin is jarred, asLocalURL copies the files 
into the config area, but relative resource are not copied. This is what 
breaks Intro. Content can be read, and is read properly when resources are 
jarred. BUT relative resources are not properly resolved. 

Now, are you saying that if I call asLocalURL() on a folder path, the logic is 
to extract all resources under that folder? If yes, then this may be a trick 
that I can do, BUT this is bad for performance. Not only are we adding logic 
to unjar the resources, which gives overhead, we endded up with the plugin 
unzipped anyway, so why jar in the first place
Comment 11 Dejan Glozic CLA 2005-04-15 14:38:15 EDT
Mazen, we should be able to support this scenario and then provide numbers to 
demonstrate that the extra step is not worth paying i.e. we need to argue that 
JARing plug-ins with intro content is a performance hit with real numbers.
Comment 12 Mazen Faraj CLA 2005-04-15 14:41:37 EDT
Dejan,
It is taken for granted that it is a performnace hit. Think about it, each 
introContent.xml and each extension that we read it extracted from the jar. So 
for sure there will be a hit. Whether that hit is big or not is solely 
determined by the size of the file. 
Comment 13 Dejan Glozic CLA 2005-04-15 14:45:29 EDT
I know. So can be back it by numbers?
Comment 14 Wassim Melhem CLA 2005-04-15 15:08:04 EDT
We will leave org.eclipse.pde jarred, until Intro finishes the investigation 
and provides tangible data that branding plugins must not be jarred.
Comment 15 Mazen Faraj CLA 2005-04-15 15:21:30 EDT
wassim,
please do not jar o.e.pde. 

I will relay on Jeff's help/pointers to make Intro work with jarred content 
plugins. And I will add performance numbers in this defect.
But, for now, Intro is broken with jarred content plugins, so please unjar.

I will ping you when this issue is resolved and ask you to please jar pde, if 
this is the route we end up taking. 

 
Comment 16 Jeff McAffer CLA 2005-04-15 15:37:04 EDT
re comment 10.  why would the whole plugin be extracted?  Only the resources 
for the intro content need to be extracted.  If they are all together in one 
directory, just extract that dir?
Comment 17 Konrad Kolosowski CLA 2005-04-15 16:00:34 EDT
We cannot not jar o.e.pde.  I has already been jarred over a week ago.
I unjarred it not especially for Mazen, but I do not buy the performance 
argument yet.  A plugin may contain many files and only small portion of them 
being intro.  It should be per plug-in decision whether it should be jarred or 
not.  For plugin like o.e.pde probably not many users are actually interested 
in its intro content, while all of them will have to go through installation 
and startup.  These will need to be considered, not just the time to extract 
intro files alone.
Now that the o.e.pde is unjarred, I hope to hear back and "for now" does not 
mean forever.
Comment 18 Mazen Faraj CLA 2005-04-15 16:10:34 EDT
Konrad,
thanks for unjarring. Hopefully this is not "forever"  (Im sure you meant it 
in a nice way! :-)  ) 

You are correct in saying the o.e.pde (or any plugin for that matter) should 
not be affected by Intro content. This is what I am trying to resolve with 
Jeff. 
Comment 19 Dejan Glozic CLA 2005-04-15 16:13:50 EDT
Note that o.e.pde is a special case - for historic reasons we needed to keep 
the builders and natures in it (because nature and builder ids are APIs and we 
could not move them into o.e.pde.core). Ideally, this plug-ins would only 
contain PDE branding info (like o.e.platform or o.e.jdt).
Comment 20 Mazen Faraj CLA 2005-04-15 16:24:08 EDT
(In reply to comment #16)
Jeff,
Javadocs for asLocalURL() say : "If the specified is a plug-in-relative URL of 
a directory,an exception is thrown". 
Is this still a true statement? Can I simply call asLocalURL() on a directory 
and you guys extract and copy all content to config area? 

I can put the restriction to make all Intro content under one directory and 
the first intro call to any resource under that directrory will extract all 
content to the config area (I can force a call to the parent folder of an 
Intro resource) but I need a blessing from you that it is ok to use the APIs 
like this. 
  
Comment 21 DJ Houghton CLA 2005-04-16 07:55:50 EDT
As Jeff mentions in comment #5, this is what we do for the about files.
Sometimes they contain relative links, files, etc so we now have the main
about.html in the plug-in root and then put all the relative files in a
directory called about_files.

Check out AboutPluginsDialog#getMoreInfoURL.

Jeff: I believe that the Platform#asLocalURL spec for dirs is incorrect. Comments?
Comment 22 Mazen Faraj CLA 2005-04-16 10:41:27 EDT
thanks DJ,
I will try that.

Maybe someone can update the follwowing page:

http://dev.eclipse.org/viewcvs/index.cgi/~checkout~/platform-core-
home/documents/3.1/run_from_jars.html 

It says that Intro content plugins can not be jarred.
Comment 23 Jeff McAffer CLA 2005-04-18 10:27:43 EDT
The doc is incorrect.  See bug 88267.
Comment 24 Mazen Faraj CLA 2005-04-19 09:47:35 EDT
added logic to intro model loading that extracts the parent folder of any 
content (ie: XML DOM) that intro loads. This means that whenever we load a 
content file, or config extension, or XHTML content file, we extract the 
parent folder assuming that allo resources are relative to the content file. 

works like a charm. I will do some performance impact testing to see how much 
overhead this means. 

Jeff,
I need your oath of faith on the following: 
1) calling asLocalURL("folderPath") on a folder that has already been 
extracted by the api has no/very very minimal perfromance impact. 
2) what happens when you call asLocalURL("folderPath") on a folder that is not 
in a jar? The javadocs where wrong, and so I want to be sure. Reason I ask, I 
now always do a call to asLocalURL("folderPath") on the parent folder of the 
resource Im loading. If the resource is not in a jar, this is a redundany and 
overhead call. Come to think about it, does a bundle know/care if it is 
jarred? can we query the platform if a bundle is jarred or not? 
   

Comment 25 Jeff McAffer CLA 2005-04-19 11:15:05 EDT
1) yes

2) nothing.  it just works.  No, you cannot tell directly that a plugin is 
jar'd.  You should not care.

Note that people should be encouraged to NOT put their intro content at the 
root of the plugin.  This new policy will then cause the entire plugin to be 
extracted.  
Comment 26 Mazen Faraj CLA 2005-04-19 15:02:21 EDT
(In reply to comment #25)
> Note that people should be encouraged to NOT put their intro content at the 
> root of the plugin.  This new policy will then cause the entire plugin to be 
> extracted.  

that right, and yes we want to avoid that. It will need to be properly 
documented.
Comment 27 Mazen Faraj CLA 2005-04-20 16:50:28 EDT
Jeff/Wassim,
I just want to point out something that Im not sure if its a bug or not. 
Try this:
self host, and in your Configuration tab make sure you do not choose to "Clear 
config area...". Now check the config area for files that have been extracted 
by runtime (eg: swt.dll and Intro stuff). On each run, a new bundle number is 
generated and this means that you are not really "reusing" the config area. 
This seems to only happen for file extracted by asLocalURL(). Other config 
area files are not regenerated. 

Does this make sense? is this how you guys want it?
 
Comment 28 Jeff McAffer CLA 2005-04-20 23:27:48 EDT
Good observation. This is actually less than optimal as it will fill up the 
disk and takes more time.  I suspect that this is actually an update issue.  If 
they think that the plugin has changed then they uninstall and reinstall. That 
causes the bundle id (the long) to be changed and thus new dirs to be used.  On 
the one hand this is wasteful.  On the other it avoids some level of cache 
coherence problems.

We could likely do better.
Comment 29 Mazen Faraj CLA 2005-04-21 04:41:41 EDT
code to handle jarring of intro plugins is now in Iv20050420.
I updated the pde, jdt, and platform plugins to include intro content just in 
one directory called intro. 

Wassim/Konrad,
thank you for waiting. You can now jar o.e.pde.
Comment 30 DJ Houghton CLA 2005-04-21 09:58:55 EDT
Do you think that the directory should be named intro_files to be consistent
with the about_files?
Comment 31 Mazen Faraj CLA 2005-04-21 10:06:24 EDT
DJ,
Is the "about_files" name hardcoded?

In the case of Intro, its not. I extract the parent folder that holds the 
introContent.xml, whatever that happens to be. So it can be anything. 
 

Comment 32 DJ Houghton CLA 2005-04-21 10:16:24 EDT
Yep, its hardcoded.
Comment 33 Mazen Faraj CLA 2005-04-21 10:20:34 EDT
when in Rome, do what the Romans do  :-) 
use the same trick for the about.html file, though it might be overkill for 
this one file.
Comment 34 Mazen Faraj CLA 2005-04-21 11:59:41 EDT
Peformance numbers:
-------------------
Time to open Intro view on a cold start: ~750 ms (see bug 90086 for details) 
Calling asLocalURL() on 23Kbytes (intro content folder in jdt: 18 files/3 
folders) takes ~ 60ms
Calling asLocalURL() on 14Kbytes (intro content folder in pde: 12 
files/3folders) takes ~ 40ms 

Performace hit for using jarred SDK plugins: 13.3% increase in startup time. 

Jeff/Dejan:
this performance hit is quite a bit. 
I'll take you input as to wether we jar pde/jdt or not. I havent even factored 
in platform because Jeff mentioned that jarring platform is debatable. 

Comment 35 Mazen Faraj CLA 2005-04-21 12:01:29 EDT
also, there is a random 10ms time when calling asLocalURL() on a folder that 
has already been extracted. So we have to factor this in, intrapolated to the 
number of plugins that have intro content. 
Comment 36 Konrad Kolosowski CLA 2005-04-21 12:42:21 EDT
Thank you, Mazen.  I have jarred o.e.pde plug-in again.
Comment 37 Jeff McAffer CLA 2005-04-21 17:47:15 EDT
re comment 33.  yes, we could be more relaxed on this.  We still want a 
convention that we always use about_files.  Intro content should be wherever it 
wants.  It is a perforance thing to put it all togehter in one sub dir.

re comment 34, that is 13% of Intro startup right, not total startup.  The real 
number is about 100ms.  What is the impact on second start (both warm and 
cold).  First start cold is going to be relatively slow.  Cold second start is 
pretty interesting.
Comment 38 Mazen Faraj CLA 2005-04-22 02:58:42 EDT
(In reply to comment #37)
> re comment 34, that is 13% of Intro startup right, not total startup.  The 
real 
> number is about 100ms.  What is the impact on second start (both warm and 
> cold).  First start cold is going to be relatively slow.  Cold second start 
is 
> pretty interesting.

thats correct, its about 13% of the Intro startup time (time between start on 
Intro plugin to right after UI id displayed).

Cold start (ie: clean config area, never ran it before) 50 and 70 ms (with the 
just newly updated jdt and pde intro plugins).

Cold second startup is actually a lot better. There are random/inconsistant 
10ms being used by calls to asLocalURL on a folder that has already been 
extracted. Intro assumed that a call to asLocalURL is very close to a no-op 
when the folder is alredy extracted. This is the case, most of the times.
Comment 39 Jeff McAffer CLA 2005-04-22 09:08:33 EDT
ok.  it would be interesting to know what the cost is if platform were jar'd.  
the platform plugin has considerably more intro content.  Again this would be a 
factor only on the very first start.  

As it stands here, the performance is reasonable.  The 10ms variation would be 
interesting to analyze/identify.
Comment 40 Mazen Faraj CLA 2005-04-25 05:10:49 EDT
wow. So your simple "it would be interesting" comment made me do a model 
design change! Here is the reason:
jarring platform works, yet the full plugin was being extracted to the config 
area.
What had happened is that Intro model used to _always_ resolve relative 
resource in the intro content file relative to the plugin install directory 
(root). To satisfy the SWT browser, we needed to always set the base element 
of the in memory html file. So we set it to the plugin install directory of 
the owner plugin. This meant that the full jarred plugin will always be 
extracted if it had intro content. 
This is far from ideal. 
Redesigned the model to introduce the concept of "base". Relative resources in 
an intro xml content file are now resolved relative to the location of the 
file (rather than plugin root). This applies to configExtensions as well. 
Meaning, configExensions loaded from another plugin are resolved relative to 
the loaction of the configExtension content file. 
Also, intro content files forked out using the "content" attribute are in 
turned resolved in the same manner.  
This change has the added advantage that existing Intro plugins that need to 
be jarred have far less work to do to enable jarring. If resources where still 
being resolved against the root of the plugin, moving intro content into a 
directory meant that each relative resource in all content files will have to 
be updated. Too tedious. With the new base model, all intro content is one 
relative block and it can be renamed, moved or whatever, and resources will be 
resolved.

NOW...
Jeff, to answer your question. When platform is jarred, here are the perf 
numbers:

<b>Performance numbers for o.e.platform:</b>
Calling asLocalURL() on 805Kbytes (intro content folder in platform: 97 
files/14 folders) takes ~ 350ms.  

Performace hit for using jarred o.e.platform plugin: 46.7% increase in startup 
time. 

So, in summary of all this defect, jarring all three intro content plugins 
gives a steep performance hit, but its only on a first ever cold start. 

Please let me know if you want me to jar the platform plugin or not. 
I would recommend against jarring it, and against jarring any intro content 
plugin. 




  
Comment 41 Mazen Faraj CLA 2005-05-03 06:14:08 EDT
o.e.pde & o.e.jdt are jarred. 
o.e.platform remains unjarred. 
Intro fully supports jarring now, so the client decides whether or not to jar 
intro content plugins.

Jeff,
Im assuming that you guys want platform unjarred, which is great with Intro. 
So Im closing this bug with the status quo. 
If otherwise, please reopen.