[RTFACT-19814] Replication is treating dot and underscore in repo name as the same Created: 04/Aug/19  Updated: 17/Sep/20

Status: Open
Project: Artifactory Binary Repository
Component/s: Config Manager, Replication
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: High
Reporter: Ariel Seftel Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: PB_Done


 Description   

Description:
When setting replication or 2 repositories with the below changes, the replication will assign the same replication key to the repositories replication, which will make the config descriptor unusable until the deletion of the manual deletion of the replication entry from the config descriptor. 

Steps to reproduce:

  1. Create 2 local repositories with the following names: 'dot.underscore-issues' and 'dot_underscore-issues' (the actual name is irrelevant just have it the same with the diff of '.' and '_')
  2. Create replication to those repositories.
  3. Once you hit save on the replication you will see the attached error (see pic 1).
  4. Although the error is shown, the configuration is saved and the <replicationKey> is the same.
  5. From that point on you can't do any configuration change until going to the config descriptor and manually delete at least one of the replication entries.
<localReplication>
<enabled>true</enabled>
<cronExp>0 0/15 * 1/1 * ? *</cronExp>
<syncDeletes>false</syncDeletes>
<syncProperties>true</syncProperties>
<repoKey>generic-local</repoKey>
<enableEventReplication>false</enableEventReplication>
<replicationKey>generic-local_http__719ccfd0e4</replicationKey>
<checkBinaryExistenceInFilestore>false</checkBinaryExistenceInFilestore>
<url>http://localhost:8081/artifactory/dot_underscore-issues</url>
<socketTimeoutMillis>15000</socketTimeoutMillis>
<username>admin</username>
<password>AM.zG8ua.AES128.2h424SyaesXwq6Y9MMsuGHGhEBe9EGN5e59BHDs4s2An1FbF</password>
<syncStatistics>false</syncStatistics>
</localReplication>

<localReplication>
<enabled>true</enabled>
<cronExp>0 0/15 * 1/1 * ? *</cronExp>
<syncDeletes>false</syncDeletes>
<syncProperties>true</syncProperties>
<repoKey>generic-local</repoKey>
<enableEventReplication>false</enableEventReplication>
<replicationKey>generic-local_http__719ccfd0e4</replicationKey>
<checkBinaryExistenceInFilestore>false</checkBinaryExistenceInFilestore>
<url>http://localhost:8081/artifactory/dot.underscore-issues</url>
<socketTimeoutMillis>15000</socketTimeoutMillis>
<username>admin</username>
<password>AM.zG8ua.AES128.2gNXYu8rHFzXYshhuq7JsidV6rjdG53KUWNMp15jEznPtSrE</password>
<syncStatistics>false</syncStatistics>
</localReplication>

Stacktrace: 

2019-08-04 09:04:20,717 [http-nio-8081-exec-10] [ERROR] (o.a.c.CentralConfigServiceImpl:642) - Failed to reload configuration: Duplicate key LocalReplication[generic-local|http://localhost:8081/artifactory/dot_underscore-issues|generic-local_http__719ccfd0e4]
java.lang.IllegalStateException: Duplicate key LocalReplication[generic-local|http://localhost:8081/artifactory/dot_underscore-issues|generic-local_http__719ccfd0e4]
at java.util.stream.Collectors.lambda$throwingMerger$115(Collectors.java:133)
at java.util.HashMap.merge(HashMap.java:1245)
at java.util.stream.Collectors.lambda$toMap$173(Collectors.java:1320)
at java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169)
at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1374)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
at org.jfrog.common.config.diff.DiffUtils.diffCollection(DiffUtils.java:75)
at org.artifactory.descriptor.config.DiffFunctionsImpl.centralConfigDescriptorImpl(DiffFunctionsImpl.java:83)
at org.artifactory.descriptor.config.DiffFunctionsImpl.lambda$new$7(DiffFunctionsImpl.java:225)
at org.artifactory.descriptor.config.DiffFunctionsImpl.diffFor(DiffFunctionsImpl.java:16)
at org.artifactory.config.CentralConfigServiceImpl.findDiff(CentralConfigServiceImpl.java:475)
at sun.reflect.GeneratedMethodAccessor344.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:201)
at com.sun.proxy.$Proxy142.findDiff(Unknown Source)
at org.artifactory.spring.ArtifactoryApplicationContext.reload(ArtifactoryApplicationContext.java:383)
at org.artifactory.config.CentralConfigServiceImpl.callReload(CentralConfigServiceImpl.java:540)
at org.artifactory.config.CentralConfigServiceImpl.reloadConfiguration(CentralConfigServiceImpl.java:524)
at org.artifactory.config.CentralConfigServiceImpl.saveDescriptor(CentralConfigServiceImpl.java:313)
at org.artifactory.config.CentralConfigServiceImpl.saveAndReloadContext(CentralConfigServiceImpl.java:621)
at org.artifactory.config.CentralConfigServiceImpl.lambda$saveAndReloadContextWithRetry$0(CentralConfigServiceImpl.java:575)
at org.jfrog.common.ExecutionUtils.handleFunctionExecution(ExecutionUtils.java:57)
at org.jfrog.common.ExecutionUtils.lambda$generateExecutionRunnable$0(ExecutionUtils.java:48)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:111)
at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:58)
at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:75)
at com.google.common.util.concurrent.MoreExecutors$DirectExecutorService.execute(MoreExecutors.java:260)
at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:112)
at com.google.common.util.concurrent.AbstractListeningExecutorService.submit(AbstractListeningExecutorService.java:56)
at com.google.common.util.concurrent.AbstractListeningExecutorService.submit(AbstractListeningExecutorService.java:36)
at org.jfrog.common.ExecutionUtils.retry(ExecutionUtils.java:41)
at org.artifactory.config.CentralConfigServiceImpl.saveAndReloadContextWithRetry(CentralConfigServiceImpl.java:574)
at org.artifactory.config.CentralConfigServiceImpl.saveEditedDescriptorAndReload(CentralConfigServiceImpl.java:516)
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:497)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:201)
at com.sun.proxy.$Proxy142.saveEditedDescriptorAndReload(Unknown Source)
at org.artifactory.ui.rest.service.admin.configuration.repositories.util.UpdateRepoConfigHelper.handleLocal(UpdateRepoConfigHelper.java:103)
at org.artifactory.ui.rest.model.admin.configuration.repository.local.LocalRepositoryConfigModel.updateRepo(LocalRepositoryConfigModel.java:142)
at org.artifactory.ui.rest.service.admin.configuration.repositories.UpdateRepositoryConfigService.execute(UpdateRepositoryConfigService.java:66)
at org.artifactory.rest.common.service.ServiceExecutor.process(ServiceExecutor.java:38)
at org.artifactory.rest.common.resource.BaseResource.runService(BaseResource.java:92)
at org.artifactory.ui.rest.resource.admin.configuration.repositories.RepoConfigResource.updateRepositoryConfig(RepoConfigResource.java:64)
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:497)
at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory.lambda$static$0(ResourceMethodInvocationHandlerFactory.java:76)
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:148)
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:191)
at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:200)
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:103)
at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:493)
at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:415)
at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:104)
at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:277)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:272)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:268)
at org.glassfish.jersey.internal.Errors.process(Errors.java:316)
at org.glassfish.jersey.internal.Errors.process(Errors.java:298)
at org.glassfish.jersey.internal.Errors.process(Errors.java:268)
at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:289)
at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:256)
at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:703)
at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:416)
at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:370)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:389)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:342)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:229)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.artifactory.webapp.servlet.RepoFilter.execute(RepoFilter.java:186)
at org.artifactory.webapp.servlet.RepoFilter.doFilter(RepoFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.artifactory.webapp.servlet.AccessFilter.useAuthentication(AccessFilter.java:426)
at org.artifactory.webapp.servlet.AccessFilter.doFilterInternal(AccessFilter.java:214)
at org.artifactory.webapp.servlet.AccessFilter.doFilter(AccessFilter.java:167)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.artifactory.webapp.servlet.RequestFilter.doFilter(RequestFilter.java:77)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.artifactory.webapp.servlet.ArtifactoryCsrfFilter.doFilter(ArtifactoryCsrfFilter.java:85)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.session.web.http.SessionRepositoryFilter.doFilterInternal(SessionRepositoryFilter.java:164)
at org.springframework.session.web.http.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:80)
at org.artifactory.webapp.servlet.SessionFilter.doFilter(SessionFilter.java:62)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.artifactory.webapp.servlet.ArtifactoryFilter.doFilter(ArtifactoryFilter.java:124)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:493)
at org.apache.catalina.valves.rewrite.RewriteValve.invoke(RewriteValve.java:279)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:800)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:800)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1471)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
2019-08-04 09:04:20,719 [http-nio-8081-exec-10] [ERROR] (o.j.c.ExecutionUtils:89) - Last retry failed: code exception. Not trying again (Failed to reload configuration: Duplicate key LocalReplication[generic-local|http://localhost:8081/artifactory/dot_underscore-issues|generic-local_http__719ccfd0e4])

 


Generated at Tue Sep 29 10:33:11 UTC 2020 using Jira 8.5.3#805003-sha1:b4933e02eaff29a49114274fe59e1f99d9d963d7.