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

Bug 308741

Summary: AIOOB exception during build
Product: [Eclipse Project] PDE Reporter: Tim deBoer <deboer>
Component: UIAssignee: Curtis Windatt <curtis.windatt.public>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: curtis.windatt.public, daniel_megert, darin.eclipse, michschn, mober.at+eclipse, pascal, remy.suen, steffen.pingel, zina
Version: 3.6   
Target Milestone: 3.7 M6   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Bug Depends on:    
Bug Blocks: 191094, 266972, 302122    
Attachments:
Description Flags
Manifest
none
Patch for 3.6.2+ none

Description Tim deBoer CLA 2010-04-10 22:20:11 EDT
I'm using 3.6 M6, and I've gotten the following build error immediately after saving an edited manifest. Not sure if it is relevant, but I got this after modifying either the required plugins or imported packages using the PDE manifest editor. There are no errors in the manifest.

Errors running builder 'Plug-in Manifest Builder' on project 'com.ibm.impact.persistence'.

java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 0
at org.eclipse.pde.internal.core.builders.BundleErrorReporter.validateRequireBundle(Unknown Source)
at org.eclipse.pde.internal.core.builders.BundleErrorReporter.validateContent(Unknown Source)
at org.eclipse.pde.internal.core.builders.ManifestConsistencyChecker.validateManifestFile(Unknown Source)
at org.eclipse.pde.internal.core.builders.ManifestConsistencyChecker.validateProject(Unknown Source)
at org.eclipse.pde.internal.core.builders.ManifestConsistencyChecker.build(Unknown Source)
at org.eclipse.core.internal.events.BuildManager$2.run(Unknown Source)
at org.eclipse.core.runtime.SafeRunner.run(Unknown Source)
at org.eclipse.core.internal.events.BuildManager.basicBuild(Unknown Source)
at org.eclipse.core.internal.events.BuildManager.basicBuild(Unknown Source)
at org.eclipse.core.internal.events.BuildManager$1.run(Unknown Source)
at org.eclipse.core.runtime.SafeRunner.run(Unknown Source)
at org.eclipse.core.internal.events.BuildManager.basicBuild(Unknown Source)
at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(Unknown Source)
at org.eclipse.core.internal.events.BuildManager.build(Unknown Source)
at org.eclipse.core.internal.events.AutoBuildJob.doBuild(Unknown Source)
at org.eclipse.core.internal.events.AutoBuildJob.run(Unknown Source)
at org.eclipse.core.internal.jobs.Worker.run(Unknown Source)
Comment 1 Remy Suen CLA 2010-04-10 22:21:57 EDT
See bug 308313.
Comment 2 Remy Suen CLA 2010-04-10 22:23:52 EDT
(In reply to comment #1)
> See bug 308313.

Actually, it seems the trace is slightly different here. :O
Comment 3 Darin Wright CLA 2010-04-12 10:53:42 EDT
Is it possible to get line numbers in the stack trace, or attach a problematic manifest to reproduce the problem?
Comment 4 Tim deBoer CLA 2010-04-13 11:31:06 EDT
Created attachment 164736 [details]
Manifest

Sorry, adopter product strips line numbers for the minimal performance gain that provides.

I've attached the manifest, but as you can see it's pretty minimal. I had seen the problem after a restart, but do not see it again this morning.
Comment 5 Zina Mostafia CLA 2010-08-11 17:57:41 EDT
Any update on this defect ? Seems it is a duplicate of  bug317237.
Comment 6 Zina Mostafia CLA 2010-08-11 17:58:25 EDT
*** Bug 317237 has been marked as a duplicate of this bug. ***
Comment 7 Curtis Windatt CLA 2010-08-13 16:23:30 EDT
I think we'll need a better test case or line numbers to figure this out.  In the example manifest provided, there is no require bundle header.  The method from the stack trace returns almost immediately if the header is not found, there are no array accesses before then.  Even if the header is present, but contains broken data, I never get an AIOOBE because all of the loops consider the array size.

The only place I could see an AIOOBE happening would be if there was a require bundle header, but the bundle description object didn't have the same data (somehow they get out of synch at startup?).  In that case, it is possible that there will be an entry in the header array, but there could be no matching entry from the bundle description.  This would cause an AIOOBE as the same index is used.

If we can't get a reproducible test case, we can guard against this case.
Comment 8 Darin Wright CLA 2010-08-18 11:22:54 EDT
Removing the 3.6.1 milestone since we don't have a reproduceable test case for this. Is this continuing to be a problem? Or can a test case be provided?
Comment 9 Tim deBoer CLA 2010-08-23 11:44:53 EDT
There is clearly a bug here (since two of us hit it in different circumstances, plus several bugs on the blocks/related list), but the frequency is low and I do not have a reproduceable testcase. I didn't see any obvious problems in the UI related to this.

In this sort of situation, my advice would be to go ahead with the guard Curtis found via scanning the code and close the bug(s); it's goodness either way, and it's not worth leaving bugs open if we don't have a clear testcase or fix. Time will tell whether the problem goes away after the change, and we can always reopen if we have a reproduceable testcase or more information.
Comment 10 Curtis Windatt CLA 2011-02-01 14:05:13 EST
Fixed in HEAD.  We now check that the length of the required bundles in the bundle description matches the entries in the manifest header.  If the counts don't match up, we assume that the bundle description has stale data and do not compare the two.

See BundleErrorReporter.java
Comment 11 Curtis Windatt CLA 2011-02-01 14:05:22 EST
*** Bug 191094 has been marked as a duplicate of this bug. ***
Comment 12 Curtis Windatt CLA 2011-02-01 14:06:02 EST
*** Bug 266972 has been marked as a duplicate of this bug. ***
Comment 13 Curtis Windatt CLA 2011-02-01 14:06:40 EST
*** Bug 302122 has been marked as a duplicate of this bug. ***
Comment 14 Curtis Windatt CLA 2011-03-22 11:57:10 EDT
Created attachment 191693 [details]
Patch for 3.6.2+