AnsweredAssumed Answered

TaggingService bug: throws ConcurrencyFailureException

Question asked by gsugiart on Jul 21, 2010
Latest reply on Jul 24, 2010 by mrogers
I have Alfresco Enterprise 3.2 and whenever I call TaggingService inside forloop, after the for loop completes in the background it throws ConcurrencyFailureException. It executed the service correctly but it throws Exception in the background.

In my case, I tried to apply tags to multiple document using TaggingService, if I have only one document to tag, there is no exception in the background. But if I have more than one document to be tagged, then the tagging works meaning all documents are tagged properly, but in the background Exception are thrown and it is really annoying

private int processBulkTagging(String[] nodeRefList, List<String> tags) {
for(int i=0;i<nodeRefList.length;i++) {         
         NodeRef nodeRef=new NodeRef(nodeRefList[i]);
                        serviceRegistry.getTaggingService().setTags(nodeRef, tags);
                   }
}

When I look at the implementation of TaggingService (org.alfresco.repo.tagging.TaggingServiceImpl), it seems like everytime I call TaggingServiceImpl.setTags(NodeRef, List<String), it calls queueTagUpdate(NodeRef, String, boolean) internally. I think this queueTagUpdate is the one that causes the Exception to be thrown in the background.

Is this a bug in TaggingService? Any suggestion on how to eliminate this Exception?

The following is the full Exception
org.alfresco.service.cmr.repository.ContentIOException: 06210018 Failed to set content property on stream closure:
   node: workspace://SpacesStore/f5b4d626-1cb7-4717-bf32-0358b279cb7f
   property: {http://www.alfresco.org/model/content/1.0}tagScopeCache
   writer: ContentAccessor[ contentUrl=store://2010/7/21/13/21/19557ec4-10c3-40d9-8040-e3a661a332f5.bin, mimetype=text/plain, size=39, encoding=UTF-8,
locale=en_US]
org.springframework.dao.ConcurrencyFailureException: ContentData with ID 1690 no longer exists
        at org.alfresco.repo.content.ContentServiceImpl$WriteStreamListener.contentStreamClosed(ContentServiceImpl.java:658)
        at org.alfresco.repo.content.AbstractContentAccessor$CallbackFileChannel$1.execute(AbstractContentAccessor.java:359)
        at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:327)
        at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:253)
        at org.alfresco.repo.content.AbstractContentAccessor$CallbackFileChannel.fireChannelClosed(AbstractContentAccessor.java:369)
        at org.alfresco.repo.content.AbstractContentAccessor$CallbackFileChannel.implCloseChannel(AbstractContentAccessor.java:338)
        at java.nio.channels.spi.AbstractInterruptibleChannel.close(AbstractInterruptibleChannel.java:97)
        at java.nio.channels.Channels$1.close(Channels.java:138)
        at java.io.FilterOutputStream.close(FilterOutputStream.java:143)
        at org.springframework.util.FileCopyUtils.copy(FileCopyUtils.java:132)
        at org.alfresco.repo.content.AbstractContentWriter.putContent(AbstractContentWriter.java:467)
        at org.alfresco.repo.tagging.UpdateTagScopesActionExecuter$1.doWork(UpdateTagScopesActionExecuter.java:191)
        at org.alfresco.repo.security.authentication.AuthenticationUtil.runAs(AuthenticationUtil.java:514)
        at org.alfresco.repo.tagging.UpdateTagScopesActionExecuter.executeImpl(UpdateTagScopesActionExecuter.java:112)
        at org.alfresco.repo.action.executer.ActionExecuterAbstractBase.execute(ActionExecuterAbstractBase.java:127)
        at org.alfresco.repo.action.ActionServiceImpl.directActionExecution(ActionServiceImpl.java:711)
        at org.alfresco.repo.action.ActionServiceImpl.executeActionImpl(ActionServiceImpl.java:648)
        at org.alfresco.repo.action.AsynchronousActionExecutionQueueImpl$ActionExecutionWrapper$1$1.execute(AsynchronousActionExecutionQueueImpl.java:
369)
        at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:327)
        at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:234)
        at org.alfresco.repo.action.AsynchronousActionExecutionQueueImpl$ActionExecutionWrapper$1.doWork(AsynchronousActionExecutionQueueImpl.java:378
)
        at org.alfresco.repo.security.authentication.AuthenticationUtil.runAs(AuthenticationUtil.java:514)
        at org.alfresco.repo.action.AsynchronousActionExecutionQueueImpl$ActionExecutionWrapper.run(AsynchronousActionExecutionQueueImpl.java:381)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:619)
Caused by: org.springframework.dao.ConcurrencyFailureException: ContentData with ID 1690 no longer exists
        at org.alfresco.repo.domain.contentdata.AbstractContentDataDAOImpl.deleteContentData(AbstractContentDataDAOImpl.java:215)
        at org.alfresco.repo.domain.contentdata.ibatis.ContentDataDAOImpl.deleteContentDataForNode(ContentDataDAOImpl.java:246)
        at org.alfresco.repo.node.db.hibernate.HibernateNodeDaoServiceImpl.addNodePropertyImpl(HibernateNodeDaoServiceImpl.java:1467)
        at org.alfresco.repo.node.db.hibernate.HibernateNodeDaoServiceImpl.addNodeProperty(HibernateNodeDaoServiceImpl.java:1513)
        at sun.reflect.GeneratedMethodAccessor436.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:304)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
        at org.alfresco.repo.transaction.TransactionalDaoInterceptor.invoke(TransactionalDaoInterceptor.java:68)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
        at org.alfresco.repo.domain.hibernate.DirtySessionMethodInterceptor.invoke(DirtySessionMethodInterceptor.java:419)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
        at org.alfresco.repo.transaction.SingleEntryTransactionResourceInterceptor.invokeInternal(SingleEntryTransactionResourceInterceptor.java:163)
        at org.alfresco.repo.transaction.SingleEntryTransactionResourceInterceptor.invoke(SingleEntryTransactionResourceInterceptor.java:138)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
        at $Proxy9.addNodeProperty(Unknown Source)
        at org.alfresco.repo.node.db.DbNodeServiceImpl.setPropertyImpl(DbNodeServiceImpl.java:1455)
        at org.alfresco.repo.node.db.DbNodeServiceImpl.setProperty(DbNodeServiceImpl.java:1419)
        at sun.reflect.GeneratedMethodAccessor434.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:304)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
        at org.alfresco.repo.tenant.MultiTNodeServiceInterceptor.invoke(MultiTNodeServiceInterceptor.java:110)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
        at $Proxy11.setProperty(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor434.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.alfresco.repo.service.StoreRedirectorProxyFactory$RedirectorInvocationHandler.invoke(StoreRedirectorProxyFactory.java:221)
        at $Proxy12.setProperty(Unknown Source)
        at org.alfresco.repo.node.MLPropertyInterceptor.invoke(MLPropertyInterceptor.java:255)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
        at org.alfresco.repo.node.NodeRefPropertyMethodInterceptor.invoke(NodeRefPropertyMethodInterceptor.java:266)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
        at org.alfresco.repo.node.NodeRefPropertyMethodInterceptor.invoke(NodeRefPropertyMethodInterceptor.java:266)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
        at $Proxy11.setProperty(Unknown Source)
        at org.alfresco.repo.content.ContentServiceImpl$WriteStreamListener.contentStreamClosed(ContentServiceImpl.java:638)
        … 25 more

Outcomes