google-cloud-eclipse
google-cloud-eclipse copied to clipboard
Flakey test in testNoTestClassesInDeploymentAssembly
Haven't seen this failure previously. On Oxygen.
testNoTestClassesInDeploymentAssembly(com.google.cloud.tools.eclipse.appengine.newproject.flex.CreateAppEngineFlexWtpProjectTest) Time elapsed: 3.068 sec <<< ERROR!
java.lang.NullPointerException: null
at org.eclipse.wst.common.componentcore.internal.impl.WorkbenchComponentImpl.findResourcesBySourcePath(WorkbenchComponentImpl.java:556)
at com.google.cloud.tools.eclipse.appengine.newproject.DeployAssemblyEntryRemoveJobTest.hasSourcePathInDeployAssembly(DeployAssemblyEntryRemoveJobTest.java:57)
at com.google.cloud.tools.eclipse.appengine.newproject.CreateAppEngineWtpProjectTest.testNoTestClassesInDeploymentAssembly(CreateAppEngineWtpProjectTest.java:199)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:48)
at com.google.cloud.tools.eclipse.test.util.ThreadDumpingWatchdog$1.evaluate(ThreadDumpingWatchdog.java:94)
at org.junit.rules.RunRules.evaluate(RunRules.java:20)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.mockito.internal.runners.JUnit45AndHigherRunnerImpl.run(JUnit45AndHigherRunnerImpl.java:37)
at org.mockito.runners.MockitoJUnitRunner.run(MockitoJUnitRunner.java:62)
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:264)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:124)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray2(ReflectionUtils.java:208)
at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:156)
at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:82)
at org.eclipse.tycho.surefire.osgibooter.OsgiSurefireBooter.run(OsgiSurefireBooter.java:95)
at org.eclipse.tycho.surefire.osgibooter.AbstractUITestApplication$1.run(AbstractUITestApplication.java:35)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:37)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:182)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4577)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4186)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1150)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1039)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:153)
at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:680)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:594)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:151)
at org.eclipse.tycho.surefire.osgibooter.UITestApplication.runApplication(UITestApplication.java:31)
at org.eclipse.tycho.surefire.osgibooter.AbstractUITestApplication.run(AbstractUITestApplication.java:120)
at org.eclipse.tycho.surefire.osgibooter.UITestApplication.start(UITestApplication.java:37)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:653)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:590)
at org.eclipse.equinox.launcher.Main.run(Main.java:1499)
at org.eclipse.equinox.launcher.Main.main(Main.java:1472)
Both this and #2781 may fail for the same reason. They both fail in org.eclipse.wst.common.componentcore.internal.impl.WorkbenchComponentImpl
. This test fails in findResourcesBySourcePath()
, while #2781 fails in findResourcesByRuntimePath()
. In both cases, the NPE is at resourceTreeRoot.findModuleResources()
.
public ComponentResource[] findResourcesByRuntimePath(IPath aDeployPath) {
ResourceTreeRoot resourceTreeRoot = ResourceTreeRoot.getDeployResourceTreeRoot(this);
return resourceTreeRoot.findModuleResources(aDeployPath, ResourceTreeNode.CREATE_NONE);
}
public ComponentResource[] findResourcesBySourcePath(IPath aSourcePath, int resourceFlag) {
ResourceTreeRoot resourceTreeRoot = ResourceTreeRoot.getSourceResourceTreeRoot(this);
return resourceTreeRoot.findModuleResources(aSourcePath, resourceFlag);
}
Hmm… the code in hasSourcePathInDeployAssembly
does its read with a StructureEdit
lock on the project, but it looks like DeployAssemblyEntryRemoveJob#run()
does not.
…but VirtualResource#removeLink()
does.
Just leaving some notes.
- The first
hasSourcePathInDeployAssembly()
was successful, so something happened before the failure of the second call. - I wonder if there is a concurrency issue in the Eclipse class
ResourceTreeRoot
:
public static ResourceTreeRoot getDeployResourceTreeRoot(WorkbenchComponent aModule) {
ResourceTreeRootAdapter resourceTreeAdapter = (...) ExtendedEcoreUtil.getAdapter(aModule, aModule.eAdapters(), ...);
if (resourceTreeAdapter != null)
return resourceTreeAdapter.getResourceTreeRoot();
resourceTreeAdapter = new ResourceTreeRootAdapter(...);
aModule.eAdapters().add(resourceTreeAdapter);
return resourceTreeAdapter.getResourceTreeRoot();
}
It seems like aModule
should add a singleton ResourceTreeRootAdapter
instance to its adapter list, but if this is called concurrently, it may end up adding more than one adapter.
-
ResourceTreeRootAdapter.getResourceTreeRoot()
OTOH creates a singleton instance in a thread-safe way.