-
Type: Bug
-
Status: Resolved
-
Priority: Major
-
Resolution: Duplicate
-
Affects Version/s: 10.10
-
Fix Version/s: None
-
Component/s: Core MongoDB, Directory
If two Nuxeo instances in a cluster start up concurrently, on MongoDB, the directory service may fail the table creation:
org.nuxeo.ecm.directory.DirectoryException: Entry with id BetacamSP already exists
at org.nuxeo.directory.mongodb.MongoDBSession.createEntryWithoutReferences(MongoDBSession.java:155) ~[nuxeo-platform-directory-mongodb-10.10-HF10.jar:?]
at org.nuxeo.ecm.directory.DirectoryCSVLoader.loadData(DirectoryCSVLoader.java:110) ~[nuxeo-platform-directory-core-10.10-HF02.jar:?]
at org.nuxeo.ecm.directory.AbstractDirectory.lambda$null$0(AbstractDirectory.java:120) ~[nuxeo-platform-directory-core-10.10-HF02.jar:?]
at org.nuxeo.runtime.api.Framework.doPrivileged(Framework.java:271) ~[nuxeo-runtime-10.10-HF10.jar:?]
at org.nuxeo.ecm.directory.AbstractDirectory.lambda$loadData$1(AbstractDirectory.java:118) ~[nuxeo-platform-directory-core-10.10-HF02.jar:?]
at org.nuxeo.runtime.transaction.TransactionHelper.lambda$runInTransaction$5(TransactionHelper.java:583) ~[nuxeo-runtime-jtajca-10.10-HF11.jar:?]
at org.nuxeo.runtime.transaction.TransactionHelper.runInTransaction(TransactionHelper.java:603) ~[nuxeo-runtime-jtajca-10.10-HF11.jar:?]
at org.nuxeo.runtime.transaction.TransactionHelper.runInTransaction(TransactionHelper.java:583) ~[nuxeo-runtime-jtajca-10.10-HF11.jar:?]
at org.nuxeo.ecm.directory.AbstractDirectory.loadData(AbstractDirectory.java:118) ~[nuxeo-platform-directory-core-10.10-HF02.jar:?]
at org.nuxeo.directory.mongodb.MongoDBDirectory.initialize(MongoDBDirectory.java:143) ~[nuxeo-platform-directory-mongodb-10.10-HF10.jar:?]
at java.util.ArrayList.forEach(ArrayList.java:1257) ~[?:1.8.0_232]
at org.nuxeo.ecm.directory.DirectoryServiceImpl.start(DirectoryServiceImpl.java:83) ~[nuxeo-platform-directory-core-10.10-HF02.jar:?]
at org.nuxeo.runtime.model.impl.RegistrationInfoImpl.start(RegistrationInfoImpl.java:381) [nuxeo-runtime-10.10-HF10.jar:?]
at org.nuxeo.runtime.model.impl.ComponentManagerImpl.startComponent(ComponentManagerImpl.java:709) [nuxeo-runtime-10.10-HF10.jar:?]
at org.nuxeo.runtime.model.impl.ComponentManagerImpl.startComponents(ComponentManagerImpl.java:691) [nuxeo-runtime-10.10-HF10.jar:?]
at org.nuxeo.runtime.model.impl.ComponentManagerImpl.start(ComponentManagerImpl.java:792) [nuxeo-runtime-10.10-HF10.jar:?]
at org.nuxeo.runtime.osgi.OSGiRuntimeService.startComponents(OSGiRuntimeService.java:447) [nuxeo-runtime-10.10-HF10.jar:?]
at org.nuxeo.runtime.osgi.OSGiRuntimeService.frameworkEvent(OSGiRuntimeService.java:462) [nuxeo-runtime-10.10-HF10.jar:?]
at org.nuxeo.osgi.OSGiAdapter.fireFrameworkEvent(OSGiAdapter.java:223) [nuxeo-runtime-osgi-10.10.jar:?]
at org.nuxeo.osgi.application.loader.FrameworkLoader.doStart(FrameworkLoader.java:225) [nuxeo-runtime-osgi-10.10.jar:?]
at org.nuxeo.osgi.application.loader.FrameworkLoader.start(FrameworkLoader.java:124) [nuxeo-runtime-osgi-10.10.jar:?]
at org.nuxeo.runtime.deployment.NuxeoStarter.start(NuxeoStarter.java:124) [nuxeo-runtime-deploy-10.10.jar:?]
at org.nuxeo.runtime.deployment.NuxeoStarter.contextInitialized(NuxeoStarter.java:93) [nuxeo-runtime-deploy-10.10.jar:?]
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4663) [catalina.jar:9.0.14]
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5131) [catalina.jar:9.0.14]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) [catalina.jar:9.0.14]
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:713) [catalina.jar:9.0.14]
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:690) [catalina.jar:9.0.14]
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:695) [catalina.jar:9.0.14]
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:631) [catalina.jar:9.0.14]
at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1832) [catalina.jar:9.0.14]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_232]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_232]
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) [tomcat-util.jar:9.0.14]
at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:112) [?:1.8.0_232]
at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:526) [catalina.jar:9.0.14]
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:425) [catalina.jar:9.0.14]
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1577) [catalina.jar:9.0.14]
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:309) [catalina.jar:9.0.14]
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123) [catalina.jar:9.0.14]
at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:424) [catalina.jar:9.0.14]
at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:367) [catalina.jar:9.0.14]
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:934) [catalina.jar:9.0.14]
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:831) [catalina.jar:9.0.14]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) [catalina.jar:9.0.14]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1382) [catalina.jar:9.0.14]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1372) [catalina.jar:9.0.14]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_232]
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) [tomcat-util.jar:9.0.14]
at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134) [?:1.8.0_232]
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:907) [catalina.jar:9.0.14]
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262) [catalina.jar:9.0.14]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) [catalina.jar:9.0.14]
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:423) [catalina.jar:9.0.14]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) [catalina.jar:9.0.14]
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:933) [catalina.jar:9.0.14]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) [catalina.jar:9.0.14]
at org.apache.catalina.startup.Catalina.start(Catalina.java:637) [catalina.jar:9.0.14]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_232]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_232]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_232]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_232]
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:350) [bootstrap.jar:9.0.14]
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:492) [bootstrap.jar:9.0.14]
We should deal with this by catching the exception, raising ConcurrentUpdateException, and letting the caller just continue in that case.