Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-29048

Some Tests randomly fail on MongoDB

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Duplicate
    • Affects Version/s: 10.10-HF25, 11.1-SNAPSHOT
    • Fix Version/s: None
    • Component/s: Core, Core DBS, Core MongoDB
    • Tags:
    • Team:
      GANG
    • Sprint:
      nxApps Transition
    • Story Points:
      3

      Description

      Note that the whole analysis above is using the MongoDB maven

      Since NXP-28958. We observed some new random test that fails on MongoDB.

      NXP-28958 fix the issue about adding new item (Document) using template and which has the root document as a parent. 

      see the fix: here and here.

      But with this new fix, we are facing a randomly failure test, for example on

      org.nuxeo.ecm.restapi.server.WorkflowEndpointTest.testRejectTaskInSubWorkflow
      
      java.lang.AssertionError: Error while invoking beforeSetup on features: [org.nuxeo.runtime.test.runner.MDCFeature, org.nuxeo.runtime.test.runner.ConditionalIgnoreRule$Feature, org.nuxeo.runtime.test.runner.RandomBug$Feature, org.nuxeo.runtime.test.runner.WithFrameworkPropertyFeature, org.nuxeo.runtime.test.runner.RuntimeFeature, org.nuxeo.runtime.cluster.ClusterFeature, org.nuxeo.runtime.test.runner.TransactionalFeature, org.nuxeo.runtime.stream.RuntimeStreamFeature, org.nuxeo.ecm.core.api.local.DummyLoginFeature, org.nuxeo.ecm.core.work.WorkManagerFeature, org.nuxeo.ecm.core.io.CoreIOFeature, org.nuxeo.ecm.core.bulk.CoreBulkFeature, org.nuxeo.ecm.core.test.CoreFeature, org.nuxeo.directory.test.DirectoryFeature, org.nuxeo.ecm.platform.test.UserManagerFeature, org.nuxeo.ecm.platform.test.PlatformFeature, org.nuxeo.runtime.test.runner.web.WebDriverFeature, org.nuxeo.runtime.test.runner.ServletContainerFeature, org.nuxeo.ecm.core.test.ServletContainerTransactionalFeature, org.nuxeo.ecm.webengine.test.WebEngineFeatureCore, org.nuxeo.ecm.webengine.test.WebEngineFeature, org.nuxeo.ecm.automation.test.AutomationFeature, org.nuxeo.ecm.automation.test.AutomationServerFeature, org.nuxeo.ecm.platform.routing.test.WorkflowFeature, org.nuxeo.runtime.management.ManagementFeature, org.nuxeo.ecm.platform.audit.AuditFeature]
      	at org.nuxeo.runtime.test.runner.FeaturesRunner.apply(FeaturesRunner.java:253)
      	at org.nuxeo.runtime.test.runner.FeaturesRunner.apply(FeaturesRunner.java:225)
      	at org.nuxeo.runtime.test.runner.FeaturesRunner.beforeSetup(FeaturesRunner.java:213)
      	at org.nuxeo.runtime.test.runner.FeaturesRunner$BeforeSetupStatement.evaluate(FeaturesRunner.java:409)
      	at org.nuxeo.runtime.test.runner.FeaturesRunner.evaluateRunnable(FeaturesRunner.java:267)
      	at org.nuxeo.runtime.test.runner.FeaturesRunner$AfterMethodRunStatement.evaluate(FeaturesRunner.java:432)
      	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
      	at org.nuxeo.runtime.test.runner.FeaturesRunner.evaluateRunnable(FeaturesRunner.java:267)
      	at org.nuxeo.runtime.test.runner.FeaturesRunner$AfterTeardownStatement.evaluate(FeaturesRunner.java:445)
      	at org.nuxeo.runtime.test.runner.FeaturesRunner$RulesFactory$1.evaluate(FeaturesRunner.java:515)
      	at org.nuxeo.runtime.test.runner.RuntimeDeployment$DeploymentStatement.evaluate(RuntimeDeployment.java:326)
      	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
      	at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
      	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
      	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
      	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
      	at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
      	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
      	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
      	at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
      	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
      	at org.nuxeo.runtime.test.runner.FeaturesRunner$AfterClassStatement.evaluate(FeaturesRunner.java:343)
      	at org.nuxeo.runtime.test.runner.FeaturesRunner$RulesFactory$1.evaluate(FeaturesRunner.java:515)
      	at org.nuxeo.runtime.test.runner.FeaturesRunner$BeforeClassStatement.evaluate(FeaturesRunner.java:326)
      	at org.junit.rules.RunRules.evaluate(RunRules.java:20)
      	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
      	at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
      	at org.junit.runners.Suite.runChild(Suite.java:128)
      	at org.junit.runners.Suite.runChild(Suite.java:27)
      	at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
      	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
      	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
      	at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
      	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
      	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
      	at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
      	at org.apache.maven.surefire.junitcore.JUnitCore.run(JUnitCore.java:55)
      	at org.apache.maven.surefire.junitcore.JUnitCoreWrapper.createRequestAndRun(JUnitCoreWrapper.java:137)
      	at org.apache.maven.surefire.junitcore.JUnitCoreWrapper.executeEager(JUnitCoreWrapper.java:107)
      	at org.apache.maven.surefire.junitcore.JUnitCoreWrapper.execute(JUnitCoreWrapper.java:83)
      	at org.apache.maven.surefire.junitcore.JUnitCoreWrapper.execute(JUnitCoreWrapper.java:75)
      	at org.apache.maven.surefire.junitcore.JUnitCoreProvider.invoke(JUnitCoreProvider.java:158)
      	at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:384)
      	at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:345)
      	at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:126)
      	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:418)
      	Suppressed: java.lang.NullPointerException
      		at org.nuxeo.ecm.core.storage.dbs.DBSTransactionState.updateDocumentReadAcls(DBSTransactionState.java:644)
      		at java.base/java.lang.Iterable.forEach(Iterable.java:75)
      		at org.nuxeo.ecm.core.storage.dbs.DBSTransactionState.updateTreeReadAcls(DBSTransactionState.java:540)
      		at org.nuxeo.ecm.core.storage.dbs.DBSSession.setACP(DBSSession.java:1409)
      		at jdk.internal.reflect.GeneratedMethodAccessor81.invoke(Unknown Source)
      		at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      		at java.base/java.lang.reflect.Method.invoke(Method.java:566)
      		at org.nuxeo.ecm.core.storage.dbs.DBSRepositoryBase$DBSSessionInvoker.invoke(DBSRepositoryBase.java:487)
      		at com.sun.proxy.$Proxy85.setACP(Unknown Source)
      		at org.nuxeo.ecm.core.api.AbstractSession.setACP(AbstractSession.java:611)
      		at org.nuxeo.ecm.core.api.AbstractSession.setACP(AbstractSession.java:596)
      		at org.nuxeo.ecm.platform.content.template.factories.SimpleTemplateBasedFactory.setAcl(SimpleTemplateBasedFactory.java:94)
      		at org.nuxeo.ecm.platform.content.template.factories.SimpleTemplateBasedRootFactory.createContentStructure(SimpleTemplateBasedRootFactory.java:58)
      		at org.nuxeo.ecm.platform.content.template.service.ContentTemplateServiceImpl.executeFactoryForType(ContentTemplateServiceImpl.java:154)
      		at org.nuxeo.ecm.platform.content.template.listener.RepositoryInitializationListener.doInitializeRepository(RepositoryInitializationListener.java:38)
      		at org.nuxeo.ecm.core.repository.RepositoryInitializationHandler.initializeRepository(RepositoryInitializationHandler.java:93)
      		at org.nuxeo.ecm.core.repository.RepositoryService$2.run(RepositoryService.java:159)
      		at org.nuxeo.ecm.core.api.UnrestrictedSessionRunner.runUnrestricted(UnrestrictedSessionRunner.java:123)
      		at org.nuxeo.ecm.core.repository.RepositoryService.initializeRepository(RepositoryService.java:161)
      		at org.nuxeo.ecm.core.repository.RepositoryService.doInitRepositories(RepositoryService.java:143)
      		at org.nuxeo.runtime.transaction.TransactionHelper.lambda$runInTransaction$5(TransactionHelper.java:587)
      		at org.nuxeo.runtime.transaction.TransactionHelper.runInTransaction(TransactionHelper.java:607)
      		at org.nuxeo.runtime.transaction.TransactionHelper.runInTransaction(TransactionHelper.java:587)
      		at org.nuxeo.ecm.core.repository.RepositoryService.initRepositories(RepositoryService.java:100)
      		at org.nuxeo.ecm.core.test.CoreFeature.initializeSession(CoreFeature.java:321)
      		at org.nuxeo.ecm.core.test.CoreFeature.beforeSetup(CoreFeature.java:218)
      		at org.nuxeo.runtime.test.runner.FeaturesRunner.lambda$beforeSetup$7(FeaturesRunner.java:213)
      		at org.nuxeo.runtime.test.runner.FeaturesRunner.apply(FeaturesRunner.java:239)
      		... 45 more
      

      After a code investigation, it seems that when we try to update the acl of the root document see here we do two things:

      1) Get the children of the root here

      2) Once we have the children, we iterate over them to update the acl here

      But the step 2 fails in some cases and we find ourselves with the NPE here

      The problem is at the meanwhile of iterating the document is removed. Note that this removing is due to an asynchronous process using the B.A.F here and the this computation is submitted from here which removes the children of a given document.

      But how starting a new test, removes a documents, this is also due to here This importer will remove the existing document and will re-import again, note that in the given example here we have `@Deploy`, and as the zip document already exist (created from the test load itself) the `@Deploy`will remove any document of the zip and it will be re-created. The remove of the document will submit a B.A.F computation to remove all children in an asynchronous way. In some case a given document is removed at the same time of the iteration (see above step2).

      This scenario is mainly observed in test, but we can face this problem at any time as because the suppression of document is done asynchronously.

       

       

       

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                saouana Salem Aouana
                Reporter:
                saouana Salem Aouana
                Participants:
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 2 days
                  2d