Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 345990 - Duplicate tld entries in taglib index
Summary: Duplicate tld entries in taglib index
Status: RESOLVED FIXED
Alias: None
Product: WTP Source Editing
Classification: WebTools
Component: jst.jsp (show other bugs)
Version: 3.3   Edit
Hardware: All All
: P3 major (vote)
Target Milestone: 3.3 RC1   Edit
Assignee: Nick Sandonato CLA
QA Contact: Nick Sandonato CLA
URL:
Whiteboard: PMC_approved
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-16 14:20 EDT by Nick Sandonato CLA
Modified: 2011-05-23 19:28 EDT (History)
4 users (show)

See Also:
nsand.dev: pmc_approved? (david_williams)
raghunathan.srinivasan: pmc_approved+
nsand.dev: pmc_approved? (naci.dai)
nsand.dev: pmc_approved? (deboer)
nsand.dev: pmc_approved? (neil.hauge)
nsand.dev: pmc_approved? (kaloyan)
nsand.dev: pmc_approved? (cbridgha)


Attachments
patch (3.20 KB, patch)
2011-05-16 14:21 EDT, Nick Sandonato CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Sandonato CLA 2011-05-16 14:20:25 EDT
+++ This bug was initially created as a clone of Bug #345778 +++

After taking a look at David's taglibindex from Bug 321602 it became apparent that TLDs were being repeated per-JAR in the taglib index.

Over time, the list grows. When restoring the references for a project description, one copy of the URLRecord was being added to the JARRecord's list. Each project could then contribute the same TLDs to back to that JARRecord. Over time, with projects feeding back superfluous entires into each other's records performance begins to degrade. Depending on the number of TLDs and the number of projects referencing those JARs, it may be awhile before any performance problems are noticed.

Easiest way to fix the problem is to delete the files from .metadata/.plugins/org.eclipse.jst.jsp.core/taglibindex
Comment 1 Nick Sandonato CLA 2011-05-16 14:21:00 EDT
Created attachment 195771 [details]
patch
Comment 2 Nick Sandonato CLA 2011-05-16 14:43:59 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.

Over time, the tld entries in the taglib index grows. Each time the workbench is shutdown and brought back up, a restoration of the tld entries increases (with the potential for exponential growth dependent on the number of projects referencing a JAR). More entires means more memory used by the collection holding the duplicate URLRecords, more time spent assembling the JARRecord since more lines need to be read from the file, and more time spent updating redundant records if the classpath changes.

* Is there a work-around? If so, why do you believe the work-around is
insufficient?

Yes. Clear out the .metadata/.plugins/org.eclipse.jst.jsp.core/taglibindex directory. It's insufficient because most people will not realize that this is here, nor is it evident that this is the cause of the performance problem.

* How has the fix been tested? Is there a test case attached to the bugzilla
record? Has a JUnit Test been added?

Ad hoc testing and inspection of the taglibindex files to make sure there are no more duplicates.

* Give a brief technical overview. Who has reviewed this fix?

The solution is to use a set instead of an arraylist of URLRecords to prevent duplicates in the JARRecord. Using a set will correct users that already have this redundant listing of TLDs in their metadata taglibindex without any further actions as well as prevent future duplicates. The size of the set per JARRecord should be relatively small.

Nitin has reviewed the fix. 

* What is the risk associated with this fix?

Minor.
Comment 3 Nick Sandonato CLA 2011-05-16 16:06:32 EDT
Thanks for the approval. Code checked in.