Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sporadic test failure in LocalAppEnginePublishOperationTest #1798

Closed
briandealwis opened this issue Apr 14, 2017 · 28 comments
Closed

Sporadic test failure in LocalAppEnginePublishOperationTest #1798

briandealwis opened this issue Apr 14, 2017 · 28 comments

Comments

@briandealwis
Copy link
Member

Test failure on Java 7 with Mars. Failing code attempts to obtain the WTP IModule for the shared project:

    sharedModule = ServerUtil.getModule(sharedProject);
    assertNotNull(sharedModule);

Nothing interesting on the transcript:

Running com.google.cloud.tools.eclipse.appengine.localserver.server.LocalAppEnginePublishOperationTest
[Watchdog] > testPublishingSubmodules(com.google.cloud.tools.eclipse.appengine.localserver.server.LocalAppEnginePublishOperationTest)
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 2.134 sec <<< FAILURE! - in com.google.cloud.tools.eclipse.appengine.localserver.server.LocalAppEnginePublishOperationTest
testPublishingSubmodules(com.google.cloud.tools.eclipse.appengine.localserver.server.LocalAppEnginePublishOperationTest)  Time elapsed: 2.132 sec  <<< FAILURE!
java.lang.AssertionError: null
	at org.junit.Assert.fail(Assert.java:86)
	at org.junit.Assert.assertTrue(Assert.java:41)
	at org.junit.Assert.assertNotNull(Assert.java:712)
	at org.junit.Assert.assertNotNull(Assert.java:722)
	at com.google.cloud.tools.eclipse.appengine.localserver.server.LocalAppEnginePublishOperationTest.setUp(LocalAppEnginePublishOperationTest.java:72)
@chanseokoh
Copy link
Contributor

I can confirm this is not new. I have seen this occasionally (quite infrequently fortunately) for a very long time.

@chanseokoh
Copy link
Contributor

chanseokoh commented May 31, 2017

Failing in the same test class but at a slightly different location:

testPublishingSubmodules(com.google.cloud.tools.eclipse.appengine.localserver.server.LocalAppEnginePublishOperationTest)  Time elapsed: 3.875 sec  <<< FAILURE!
java.lang.AssertionError: null
	at org.junit.Assert.fail(Assert.java:86)
	at org.junit.Assert.assertTrue(Assert.java:41)
	at org.junit.Assert.assertTrue(Assert.java:52)
	at com.google.cloud.tools.eclipse.appengine.localserver.server.LocalAppEnginePublishOperationTest.testPublishingSubmodules(LocalAppEnginePublishOperationTest.java:114)

The class file classes/sox/server/GreetingServiceImpl.class doesn't seem to exist in the publish directory.

@chanseokoh
Copy link
Contributor

chanseokoh commented Jun 15, 2017

Got another interesting error:

testPublishingSubmodules(com.google.cloud.tools.eclipse.appengine.localserver.server.LocalAppEnginePublishOperationTest)  Time elapsed: 6.875 sec  <<< FAILURE!
java.lang.AssertionError: Imported projects have errors
/sox-server:-1: The project cannot be built until build path errors are resolved
	at org.junit.Assert.fail(Assert.java:88)
	at org.junit.Assert.assertTrue(Assert.java:41)
	at com.google.cloud.tools.eclipse.test.util.project.ProjectUtils.failIfBuildErrors(ProjectUtils.java:143)
	at com.google.cloud.tools.eclipse.test.util.project.ProjectUtils.failIfBuildErrors(ProjectUtils.java:137)
	at com.google.cloud.tools.eclipse.test.util.project.ProjectUtils.importProjects(ProjectUtils.java:123)
	at com.google.cloud.tools.eclipse.appengine.localserver.server.LocalAppEnginePublishOperationTest.setUp(LocalAppEnginePublishOperationTest.java:57)

@briandealwis
Copy link
Member Author

Hit again (full log) on Neon. I wonder if there's a pending operation happening here.

[Watchdog] > testPublishingSubmodules(com.google.cloud.tools.eclipse.appengine.localserver.server.LocalAppEnginePublishOperationTest)
Window manager warning: Buggy client sent a _NET_ACTIVE_WINDOW message with a timestamp of 0 for 0x80025b (User Opera)
Window manager warning: meta_window_activate called by a pager with a 0 timestamp; the pager needs to be fixed.
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 3.711 sec <<< FAILURE! - in com.google.cloud.tools.eclipse.appengine.localserver.server.LocalAppEnginePublishOperationTest
testPublishingSubmodules(com.google.cloud.tools.eclipse.appengine.localserver.server.LocalAppEnginePublishOperationTest)  Time elapsed: 3.682 sec  <<< FAILURE!
java.lang.AssertionError: null
	at org.junit.Assert.fail(Assert.java:86)
	at org.junit.Assert.assertTrue(Assert.java:41)
	at org.junit.Assert.assertTrue(Assert.java:52)
	at com.google.cloud.tools.eclipse.appengine.localserver.server.LocalAppEnginePublishOperationTest.testPublishingSubmodules(LocalAppEnginePublishOperationTest.java:114)

@chanseokoh
Copy link
Contributor

chanseokoh commented Jun 19, 2017

So we get errors at various stages:

We know ProjectUtils.waitForProjects() does wait for auto-build jobs until there won't be any build errors. I wonder if we need to call refreshLocal() at this point.

@briandealwis
Copy link
Member Author

Maybe call ThreadDumpingWatchdog#run() to see what other jobs are pending?

@briandealwis
Copy link
Member Author

Seen on the Java 7/Mars build:

Running com.google.cloud.tools.eclipse.appengine.localserver.server.LocalAppEnginePublishOperationTest
[Watchdog] > testPublishingSubmodules(com.google.cloud.tools.eclipse.appengine.localserver.server.LocalAppEnginePublishOperationTest)
Importing 2 projects:
    /home/travis/build/GoogleCloudPlatform/google-cloud-eclipse/plugins/com.google.cloud.tools.eclipse.appengine.localserver.test/target/work/data/sox-server/.project
    /home/travis/build/GoogleCloudPlatform/google-cloud-eclipse/plugins/com.google.cloud.tools.eclipse.appengine.localserver.test/target/work/data/sox-shared/.project
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 2.882 sec <<< FAILURE! - in com.google.cloud.tools.eclipse.appengine.localserver.server.LocalAppEnginePublishOperationTest
testPublishingSubmodules(com.google.cloud.tools.eclipse.appengine.localserver.server.LocalAppEnginePublishOperationTest)  Time elapsed: 2.879 sec  <<< FAILURE!
java.lang.AssertionError: Imported projects have errors
/sox-server:-1: The project cannot be built until build path errors are resolved
	at org.junit.Assert.fail(Assert.java:88)
	at org.junit.Assert.assertTrue(Assert.java:41)
	at com.google.cloud.tools.eclipse.test.util.project.ProjectUtils.failIfBuildErrors(ProjectUtils.java:167)
	at com.google.cloud.tools.eclipse.test.util.project.ProjectUtils.failIfBuildErrors(ProjectUtils.java:161)
	at com.google.cloud.tools.eclipse.test.util.project.ProjectUtils.importProjects(ProjectUtils.java:147)
	at com.google.cloud.tools.eclipse.test.util.project.ProjectUtils.importProjects(ProjectUtils.java:89)
	at com.google.cloud.tools.eclipse.appengine.localserver.server.LocalAppEnginePublishOperationTest.setUp(LocalAppEnginePublishOperationTest.java:57)

@elharo
Copy link
Contributor

elharo commented Dec 13, 2017

Another one:

Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 3.095 sec <<< FAILURE! - in com.google.cloud.tools.eclipse.appengine.localserver.server.LocalAppEnginePublishOperationTest
testPublishingSubmodules(com.google.cloud.tools.eclipse.appengine.localserver.server.LocalAppEnginePublishOperationTest)  Time elapsed: 3.092 sec  <<< FAILURE!
java.lang.AssertionError: Imported projects have errors
/sox-server:-1: The project cannot be built until build path errors are resolved
	at org.junit.Assert.fail(Assert.java:88)
	at org.junit.Assert.assertTrue(Assert.java:41)
	at com.google.cloud.tools.eclipse.test.util.project.ProjectUtils.failIfBuildErrors(ProjectUtils.java:167)
	at com.google.cloud.tools.eclipse.test.util.project.ProjectUtils.failIfBuildErrors(ProjectUtils.java:161)
	at com.google.cloud.tools.eclipse.test.util.project.ProjectUtils.importProjects(ProjectUtils.java:147)
	at com.google.cloud.tools.eclipse.test.util.project.ProjectUtils.importProjects(ProjectUtils.java:89)
	at com.google.cloud.tools.eclipse.appengine.localserver.server.LocalAppEnginePublishOperationTest.setUp(LocalAppEnginePublishOperationTest.java:57)

@briandealwis
Copy link
Member Author

I wonder if there's another project with an error that is somehow being picked up.

@elharo
Copy link
Contributor

elharo commented Jan 29, 2018

Just saw this one again on Travis:

Tests run: 8, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 43.601 sec - in com.google.cloud.tools.eclipse.appengine.localserver.launching.LaunchHelperTest
testToProjectWithJavaProject(com.google.cloud.tools.eclipse.appengine.localserver.launching.LaunchHelperTest)  Time elapsed: 3.465 sec
failsWithClashingServiceIds(com.google.cloud.tools.eclipse.appengine.localserver.launching.LaunchHelperTest)  Time elapsed: 9.66 sec
testInvariantToModuleOrder(com.google.cloud.tools.eclipse.appengine.localserver.launching.LaunchHelperTest)  Time elapsed: 9.644 sec
failsIfAlreadyLaunched(com.google.cloud.tools.eclipse.appengine.localserver.launching.LaunchHelperTest)  Time elapsed: 3.236 sec
testToProjectWithFile(com.google.cloud.tools.eclipse.appengine.localserver.launching.LaunchHelperTest)  Time elapsed: 3.101 sec
testWithTwoModules(com.google.cloud.tools.eclipse.appengine.localserver.launching.LaunchHelperTest)  Time elapsed: 8.298 sec
testWithDefaultModule(com.google.cloud.tools.eclipse.appengine.localserver.launching.LaunchHelperTest)  Time elapsed: 3.086 sec
testToProjectWithProject(com.google.cloud.tools.eclipse.appengine.localserver.launching.LaunchHelperTest)  Time elapsed: 3.095 sec
Running com.google.cloud.tools.eclipse.appengine.localserver.server.LocalAppEnginePublishOperationTest
[Watchdog] > testPublishingSubmodules(com.google.cloud.tools.eclipse.appengine.localserver.server.LocalAppEnginePublishOperationTest)
Importing 2 projects:
    /home/travis/build/GoogleCloudPlatform/google-cloud-eclipse/plugins/com.google.cloud.tools.eclipse.appengine.localserver.test/target/work/data/sox-server/.project
    /home/travis/build/GoogleCloudPlatform/google-cloud-eclipse/plugins/com.google.cloud.tools.eclipse.appengine.localserver.test/target/work/data/sox-shared/.project
  #### Testing getModules(sox-server) ####
    * ModuleFactory[org.eclipse.jst.j2ee.server] (not enabled, skipping)
      - All factory modules: sox-shared
    * ModuleFactory[org.eclipse.wst.web.internal.deployables.static]
      - All factory modules: <empty>
      - Project modules: <empty>
    * ModuleFactory[org.eclipse.jst.jee.server]
      - All factory modules: <empty>
      - Project modules: <empty>
  #### Testing getModules(sox-shared) ####
    * ModuleFactory[org.eclipse.jst.j2ee.server]
      - All factory modules: sox-shared
      - Project modules: sox-shared
    * ModuleFactory[org.eclipse.wst.web.internal.deployables.static]
      - All factory modules: <empty>
      - Project modules: <empty>
    * ModuleFactory[org.eclipse.jst.jee.server]
      - All factory modules: <empty>
      - Project modules: <empty>
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 3.111 sec <<< FAILURE! - in com.google.cloud.tools.eclipse.appengine.localserver.server.LocalAppEnginePublishOperationTest
testPublishingSubmodules(com.google.cloud.tools.eclipse.appengine.localserver.server.LocalAppEnginePublishOperationTest)  Time elapsed: 3.106 sec  <<< FAILURE!
java.lang.AssertionError: null
	at org.junit.Assert.fail(Assert.java:86)
	at org.junit.Assert.assertTrue(Assert.java:41)
	at org.junit.Assert.assertNotNull(Assert.java:712)
	at org.junit.Assert.assertNotNull(Assert.java:722)
	at com.google.cloud.tools.eclipse.appengine.localserver.server.LocalAppEnginePublishOperationTest.setUp(LocalAppEnginePublishOperationTest.java:77)

@chanseokoh
Copy link
Contributor

Comparing the output with #2682 (comment), the org.eclipse.jst.jee.server ModuleFactory does not seem to be fully initialized? Why, that I have no idea.

@briandealwis
Copy link
Member Author

Hit this twice today, once on Travis and once on Kokoro Windows (!):

[Watchdog] > testPublishingSubmodules(com.google.cloud.tools.eclipse.appengine.localserver.server.LocalAppEnginePublishOperationTest)
Importing 2 projects:
T:/src/github/google-cloud-eclipse/plugins/com.google.cloud.tools.eclipse.appengine.localserver.test/target/work/data/sox-server/.project
T:/src/github/google-cloud-eclipse/plugins/com.google.cloud.tools.eclipse.appengine.localserver.test/target/work/data/sox-shared/.project
#### Testing getModules(sox-server) ####
* ModuleFactory[org.eclipse.jst.j2ee.server] (not enabled, skipping)
- All factory modules: sox-shared
* ModuleFactory[org.eclipse.wst.web.internal.deployables.static]
- All factory modules: <empty>
- Project modules: <empty>
* ModuleFactory[org.eclipse.jst.jee.server]
- All factory modules: <empty>
- Project modules: <empty>
#### Testing getModules(sox-shared) ####
* ModuleFactory[org.eclipse.jst.j2ee.server]
- All factory modules: sox-shared
- Project modules: sox-shared
* ModuleFactory[org.eclipse.wst.web.internal.deployables.static]
- All factory modules: <empty>
- Project modules: <empty>
* ModuleFactory[org.eclipse.jst.jee.server]
- All factory modules: <empty>
- Project modules: <empty>
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 2.393 sec <<< FAILURE! - in com.google.cloud.tools.eclipse.appengine.localserver.server.LocalAppEnginePublishOperationTest
testPublishingSubmodules(com.google.cloud.tools.eclipse.appengine.localserver.server.LocalAppEnginePublishOperationTest)  Time elapsed: 2.393 sec  <<< FAILURE!
java.lang.AssertionError: null
at org.junit.Assert.fail(Assert.java:86)
at org.junit.Assert.assertTrue(Assert.java:41)
at org.junit.Assert.assertNotNull(Assert.java:712)
at org.junit.Assert.assertNotNull(Assert.java:722)
at com.google.cloud.tools.eclipse.appengine.localserver.server.LocalAppEnginePublishOperationTest.setUp(LocalAppEnginePublishOperationTest.java:77)

@briandealwis
Copy link
Member Author

Another failure on Travis with Oxygen:

Running com.google.cloud.tools.eclipse.appengine.localserver.server.LocalAppEnginePublishOperationTest
[Watchdog] > testPublishingSubmodules(com.google.cloud.tools.eclipse.appengine.localserver.server.LocalAppEnginePublishOperationTest)
Importing 2 projects:
    /home/travis/build/GoogleCloudPlatform/google-cloud-eclipse/plugins/com.google.cloud.tools.eclipse.appengine.localserver.test/target/work/data/sox-server/.project
    /home/travis/build/GoogleCloudPlatform/google-cloud-eclipse/plugins/com.google.cloud.tools.eclipse.appengine.localserver.test/target/work/data/sox-shared/.project
+-------------------------------------------------------------------------------
| STACK DUMP @ 2.002 min: testPublishingSubmodules(com.google.cloud.tools.eclipse.appengine.localserver.server.LocalAppEnginePublishOperationTest)
|
|
| 3 jobs:
|   SLEEPING{pri=30,system,rule=R/} Periodic workspace save.(6) (org.eclipse.core.internal.resources.DelayedSnapshotJob)
|   SLEEPING{pri=30,system} Workbench Auto-Save Job(15) (org.eclipse.ui.internal.Workbench$41)
|   SLEEPING{pri=50,system} Compacting resource model(12) (org.eclipse.core.internal.utils.StringPoolJob)
|
| "main" [1] TIMED_WAITING
|     at java.lang.Thread.sleep(Native Method)
|     at com.google.cloud.tools.eclipse.test.util.project.ProjectUtils.waitUntilNoBuildErrors(ProjectUtils.java:185)
|     at com.google.cloud.tools.eclipse.test.util.project.ProjectUtils.waitUntilNoBuildErrors(ProjectUtils.java:161)
|     at com.google.cloud.tools.eclipse.test.util.project.ProjectUtils.importProjects(ProjectUtils.java:144)

|     at com.google.cloud.tools.eclipse.test.util.project.ProjectUtils.importProjects(ProjectUtils.java:88)
|     at com.google.cloud.tools.eclipse.appengine.localserver.server.LocalAppEnginePublishOperationTest.setUp(LocalAppEnginePublishOperationTest.java:60)
[… trimmed…]
 #### Testing getModules(sox-server) ####
    * ModuleFactory[org.eclipse.jst.j2ee.server] (not enabled, skipping)
      - All factory modules: sox-shared
    * ModuleFactory[org.eclipse.wst.web.internal.deployables.static]
      - All factory modules: <empty>
      - Project modules: <empty>
    * ModuleFactory[org.eclipse.jst.jee.server]
      - All factory modules: sox-server
      - Project modules: sox-server
  #### Testing getModules(sox-shared) ####
    * ModuleFactory[org.eclipse.jst.j2ee.server]
      - All factory modules: sox-shared
      - Project modules: sox-shared
    * ModuleFactory[org.eclipse.wst.web.internal.deployables.static]
      - All factory modules: <empty>
      - Project modules: <empty>
    * ModuleFactory[org.eclipse.jst.jee.server]
      - All factory modules: sox-server
      - Project modules: <empty>
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 303.284 sec <<< FAILURE! - in com.google.cloud.tools.eclipse.appengine.localserver.server.LocalAppEnginePublishOperationTest
testPublishingSubmodules(com.google.cloud.tools.eclipse.appengine.localserver.server.LocalAppEnginePublishOperationTest)  Time elapsed: 303.28 sec  <<< FAILURE!
java.lang.AssertionError: null
	at org.junit.Assert.fail(Assert.java:86)
	at org.junit.Assert.assertTrue(Assert.java:41)
	at org.junit.Assert.assertTrue(Assert.java:52)
	at com.google.cloud.tools.eclipse.appengine.localserver.server.LocalAppEnginePublishOperationTest.testPublishingSubmodules(LocalAppEnginePublishOperationTest.java:121)

@chanseokoh
Copy link
Contributor

assertTrue(new File(webInf, "classes/sox/server/GreetingServiceImpl.class").isFile());

About the above failure, I can reproduce it if I turn off the auto-building before importing the projects.

  public void setUp() throws IOException, CoreException, InterruptedException {
    // disable auto-building
    IWorkspace workspace = ResourcesPlugin.getWorkspace();
    IWorkspaceDescription desc = workspace.getDescription();
    desc.setAutoBuilding(false);
    workspace.setDescription(desc);

    projects = ProjectUtils.importProjects(getClass(),

It may be that the publish is done before the project is fully built. I think the fact that the following assertions on static files that preceded the failure are OK supports this.

    assertTrue(new File(webInf, "appengine-web.xml").isFile());
    assertTrue(new File(webInf, "web.xml").isFile());
    assertTrue(new File(webInf, "classes/sox/server/GreetingServiceImpl.class").isFile());

What is weird is that, ProjectUtils.importProjects() does call waitForProjects() and check build errors. It may be a good idea to add some debug code to check if the project is fully built.

@chanseokoh
Copy link
Contributor

chanseokoh commented Mar 16, 2018

Indeed, my suspicion was right. It just hit the debug code from #2917, proving that a .class file doesn't exist after ProjectUtils.importProjects(), which does waitForProjects() and waitUntilNoBuildErrors(). I think waitForProjects() is not perfect and does not guarantee build completion:

Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 305.399 sec <<< FAILURE! - in com.google.cloud.tools.eclipse.appengine.localserver.server.LocalAppEnginePublishOperationTest

testPublishingSubmodules(com.google.cloud.tools.eclipse.appengine.localserver.server.LocalAppEnginePublishOperationTest)  Time elapsed: 305.381 sec  <<< FAILURE!

java.lang.AssertionError: null
	at org.junit.Assert.fail(Assert.java:86)
	at org.junit.Assert.assertTrue(Assert.java:41)
	at org.junit.Assert.assertTrue(Assert.java:52)
	at com.google.cloud.tools.eclipse.appengine.localserver.server.LocalAppEnginePublishOperationTest.setUp(LocalAppEnginePublishOperationTest.java:81)

Now that we know the root cause, we're close to finally close this issue. I think for this flakiness, we will just wait in a loop until the classes we are interested in are generated.

And we shouldn't forget that waitForProjects() doesn't guarantee build completion from now on.

@chanseokoh
Copy link
Contributor

Make sure to remove the diagnostic code before closing this issue.

@briandealwis
Copy link
Member Author

I hit a similar issue with #2914 and realized that I had written a job that had no belongsTo(), and so waitForProjects() wasn't waiting for the job.

@chanseokoh
Copy link
Contributor

LocalAppEnginePublishOperationTest-sharedModule-null.txt

Just hit the error that sharedModule is null, even after #2917 which waits another 10 seconds after successful project import. At least serverModule was ready and not null, so that's the difference from previous errors. According to the log, the loop that is supposed to take around 10 seconds took way more time. Not sure if this is due to the system being slow for some reason. Based on this, I wonder if the shared module might have become ready if given more time.

@elharo
Copy link
Contributor

elharo commented Mar 20, 2018

We should add a comment to waitForProjects() javadoc that it doesn't guarantee build completion.

@briandealwis
Copy link
Member Author

There's something deeper going on as the build should have finished after 22s.

I wonder if this is the same problem causing issues with #1529, which I believe was fixed by Eclipse bug 478634 and committed to Oxygen.3. I see our .target is still against .2 so I'll re-generate the .target against .3 and resubmit #1529 and lets see if this problem recurs.

@chanseokoh
Copy link
Contributor

Note that there are three separate issues mixed in this one GitHub issue (#1798 (comment)). I feel that the build error issue and the publish-before-build error have been taken care of. The module loading issue is what we continue to hit, even after we give 10 more seconds to Eclipse (#2917). I feel Eclipse fails to initialize or load modules. One option as a last resort could be to delete the projects and re-import if this happens?

@chanseokoh
Copy link
Contributor

So, there remains one last flaky behavior with this test. There is an error marker that never goes away after importing the project. At the 4-minute mark:

+-------------------------------------------------------------------------------
| STACK DUMP @ 4.001 min: testPublishingSubmodules(com.google.cloud.tools.eclipse.appengine.localserver.server.LocalAppEnginePublishOperationTest)
|
|
| 3 jobs:
|   SLEEPING{pri=30,system,rule=R/} Periodic workspace save.(6) (org.eclipse.core.internal.resources.DelayedSnapshotJob)
|   SLEEPING{pri=30,system} Workbench Auto-Save Job(15) (org.eclipse.ui.internal.Workbench$41)
|   SLEEPING{pri=50,system} Compacting resource model(12) (org.eclipse.core.internal.utils.StringPoolJob)
|
| "main" [1] TIMED_WAITING
|     at java.lang.Thread.sleep(Native Method)
|     at com.google.cloud.tools.eclipse.test.util.project.ProjectUtils.waitUntilNoBuildErrors(ProjectUtils.java:187)
|     at com.google.cloud.tools.eclipse.test.util.project.ProjectUtils.waitUntilNoBuildErrors(ProjectUtils.java:163)
|     at com.google.cloud.tools.eclipse.test.util.project.ProjectUtils.importProjects(ProjectUtils.java:146)
|     at com.google.cloud.tools.eclipse.test.util.project.ProjectUtils.importProjects(ProjectUtils.java:89)
|     at com.google.cloud.tools.eclipse.appengine.localserver.server.LocalAppEnginePublishOperationTest.setUp(LocalAppEnginePublishOperationTest.java:61)

I wonder what the error(s) are. That said, ProjectUtils.failIfBuildErrors(String, IProject...) is buggy and does not fail the import at the following location.

    if (checkBuildErrors) {
      waitUntilNoBuildErrors();
      // changed from specific projects to see all possible errors
      failIfBuildErrors("Imported projects have errors");
    }

It should have a failIfBuildErrors(String) specialization like the 0-arg failIfBuildErrors() that captures all projects (calling getWorkspace().getRoot().getProjects()).

@chanseokoh chanseokoh reopened this May 29, 2018
@chanseokoh
Copy link
Contributor

Finally, #3117 reveals the error that is causing ProjectUtils.importProjects() to fail on these two projects. The error actually seems stale and can be ignored.

Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 307.341 sec <<< FAILURE! - in com.google.cloud.tools.eclipse.appengine.localserver.server.LocalAppEnginePublishOperationTest
testPublishingSubmodules(com.google.cloud.tools.eclipse.appengine.localserver.server.LocalAppEnginePublishOperationTest)  Time elapsed: 307.325 sec  <<< FAILURE!
java.lang.AssertionError: Imported projects have errors
/sox-server:-1: Project 'sox-server' is missing required Java project: 'sox-shared'
/sox-server:-1: The project cannot be built until build path errors are resolved
	at org.junit.Assert.fail(Assert.java:88)
	at org.junit.Assert.assertTrue(Assert.java:41)
	at com.google.cloud.tools.eclipse.test.util.project.ProjectUtils.failIfBuildErrors(ProjectUtils.java:204)
	at com.google.cloud.tools.eclipse.test.util.project.ProjectUtils.importProjects(ProjectUtils.java:148)
	at com.google.cloud.tools.eclipse.test.util.project.ProjectUtils.importProjects(ProjectUtils.java:89)
	at com.google.cloud.tools.eclipse.appengine.localserver.server.LocalAppEnginePublishOperationTest.setUp(LocalAppEnginePublishOperationTest.java:61)

@chanseokoh
Copy link
Contributor

Maybe refreshing sox-server could clear the error. Not sure how to refresh it programmatically. At least closing and re-opening would do it.

Another potentially better approach would be to import sox-shared first, wait for it to be clear of any errors, and then import sox-server.

@briandealwis
Copy link
Member Author

The workspace should do a rebuild once sox-shared was available. To me this suggests that somehow sox-shared has not been properly added.

@chanseokoh
Copy link
Contributor

"waitUntilNoBuildErrors" and "failIfBuildErrors" both wait for and check any errors in the workspace, and this error was the only one reported. Note IProject.open(sox-shared) returned without an error, and no error has been reported on sox-shared. Even if there were an error on sox-shared, the message "sox-shared is missing" doesn't make sense. Maybe there is a bug on rebuild if depending projects open almost at the same time very quickly due to some race condition?

After all, I think it's more robust to open the projects one by one.

@briandealwis
Copy link
Member Author

I've been importing multiple projects at a time for years using the Import Existing Projects wizard and never seen this issue.

I'm more inclined to requesting a clean build.

@chanseokoh
Copy link
Contributor

chanseokoh commented Jun 5, 2018

I don't doubt the import wizard fails to create and open projects. I'm theorizing that when one of the projects being opened depends on another project in the open set, the build system may somehow fail to either recognize the dependent project becoming available, trigger a rebuild, or refresh it. After all, it is clearly a bug that the false error doesn't go away for 5 minutes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants