Community
Participate
Working Groups
One of the nightly tests failed with an NPE: http://download.eclipse.org/eclipse/downloads/drops/N20101113-2000/testresults/html/org.eclipse.pde.api.tools.tests_macosx.cocoa.x86_5.0.html java.lang.NullPointerException at org.eclipse.core.internal.resources.Project.internalGetReferencedBuildConfigurations(Project.java:843) at org.eclipse.core.internal.resources.Workspace.computeActiveBuildConfigurationOrder(Workspace.java:711) at org.eclipse.core.internal.resources.Workspace.getBuildOrder(Workspace.java:1592) at org.eclipse.core.internal.resources.Workspace.build(Workspace.java:415) at org.eclipse.jdt.core.tests.builder.TestingEnvironment.fullBuild(TestingEnvironment.java:464) at org.eclipse.jdt.core.tests.builder.BuilderTests.fullBuild(BuilderTests.java:390) at org.eclipse.pde.api.tools.builder.tests.compatibility.BundleVersionTests.setupTest(BundleVersionTests.java:157) at org.eclipse.pde.api.tools.builder.tests.compatibility.BundleVersionTests.test003(BundleVersionTests.java:227) at org.eclipse.test.EclipseTestRunner.run(EclipseTestRunner.java:377) at org.eclipse.test.EclipseTestRunner.run(EclipseTestRunner.java:210) at org.eclipse.test.CoreTestApplication.runTests(CoreTestApplication.java:36)
The 3 other test failures in org.eclipse.pde.api.tools.tests also look new.
(In reply to comment #1) > The 3 other test failures in org.eclipse.pde.api.tools.tests also look new. test328464 is my fault. I enabled this test accidentally. Pawel P. should have fixed bug 329836 first.
The NPE can only happen if getAllBuildConfigReferences() returns null. AFAICS this can only happen due to concurrent access (no memory barrier between the cache read + write as well as no protection for concurrent cache update). A more interesting problem is that the PDE tests modify the dynamic order during the pre-build listener. Workspace.build will then go wrong as we're calculating the order before notifying pre-build. This is an interesting regression and definitely needs a test.
After running the API tools tests locally on N20101114-2000, I found a pile of console entries like: "The project cannot be built until its prerequisite exportedbundle is built. Cleaning and building all projects is recommended" that accompany the NPE / 'Should not be a JDT error' failures. This would seem to confirm comment#3.
Created attachment 183142 [details] fix v1 Fix for the issue. Move build order calculation for Workspace#build after the pre-build notification. The buildOrder calculation is now done within the ws lock. PDE tests now pass, as do core.resources builder tests. Looks like some additional synchronization on the build config reference cache is needed to guard against outside callers of IProject#getReferencedBuildConfigurations and IProject#getReferencedProjects
The fix is in HEAD.
Created attachment 183197 [details] patch 2 + test - Add a test that checks changing build order in the pre build notification works for both API IWorkspace#build and Auto build. - Ensure that the ProjectDesc Build configuration cache is correctly synchronized. This cache is lazy populated on get (this path isn't necessarily locked by the WS lock). Consequently we the data-structure is vulnerable to concurrent modification. - Tidy the Workspace#build moving the remaining implementation into buildInternal so it's less confusing what's going on. - Minor non-Javadoc and argument order tweak.
James, I will commit the fix after the IBuild today.