Expand my Community achievements bar.

SOLVED

oakState0002: Conflicting concurrent change on branch commits

Avatar

Level 2

Hi everyone,

                     As part of regular deliver of the content to different audiences, assets get published to publishers and unpublished from publishers. I have 3 replication queues for 3 categories of the assets so that no blocking or waiting for each other. I am using replication API to replicate specific category assets to specific replication agent. I do process the metadata of the asset before publishing/unpublishing it and when i say resourceResolver.commit(), i am getting below exception and it is so frequent for many assets. If i reprocess these assets, they work fine without any issue. I am not very sure what exactly the issue here.

org.apache.sling.api.resource.PersistenceException: Unable to commit changes to session.

at org.apache.sling.jcr.resource.internal.helper.jcr.JcrResourceProvider.commit(JcrResourceProvider.java:482)

at org.apache.sling.resourceresolver.impl.providers.stateful.AuthenticatedResourceProvider.commit(AuthenticatedResourceProvider.java:215)

at org.apache.sling.resourceresolver.impl.helper.ResourceResolverControl.commit(ResourceResolverControl.java:411)

at org.apache.sling.resourceresolver.impl.ResourceResolverImpl.commit(ResourceResolverImpl.java:1262)

Caused by: javax.jcr.InvalidItemStateException: OakState0002: Conflicting concurrent change on branch commits [r16126faf91f-0-4, r16126fab61d-0-4, r16126f66a91-0-4, ....]

at org.apache.jackrabbit.oak.api.CommitFailedException.asRepositoryException(CommitFailedException.java:237)

at org.apache.jackrabbit.oak.api.CommitFailedException.asRepositoryException(CommitFailedException.java:212)

at org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.newRepositoryException(SessionDelegate.java:670)

at org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.save(SessionDelegate.java:496)

at org.apache.jackrabbit.oak.jcr.session.SessionImpl$8.performVoid(SessionImpl.java:419)

at org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.performVoid(SessionDelegate.java:274)

at org.apache.jackrabbit.oak.jcr.session.SessionImpl.save(SessionImpl.java:416)

at sun.reflect.GeneratedMethodAccessor46.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:498)

at org.apache.sling.jcr.base.SessionProxyHandler$SessionProxyInvocationHandler.invoke(SessionProxyHandler.java:116)

at com.sun.proxy.$Proxy7.save(Unknown Source)

at org.apache.sling.jcr.resource.internal.helper.jcr.JcrResourceProvider.commit(JcrResourceProvider.java:480)

... 16 common frames omitted

Caused by: org.apache.jackrabbit.oak.api.CommitFailedException: OakState0002: Conflicting concurrent change on branch commits [r16126faf91f-0-4, r16126fab61d-0-4, r16126f66a91-0-4, ...]

at org.apache.jackrabbit.oak.plugins.document.DocumentNodeStoreBranch$Persisted.checkForConflicts(DocumentNodeStoreBranch.java:654)

at org.apache.jackrabbit.oak.plugins.document.DocumentNodeStoreBranch$Persisted.access$400(DocumentNodeStoreBranch.java:529)

at org.apache.jackrabbit.oak.plugins.document.DocumentNodeStoreBranch$Persisted$1.call(DocumentNodeStoreBranch.java:589)

at org.apache.jackrabbit.oak.plugins.document.DocumentNodeStoreBranch$Persisted$1.call(DocumentNodeStoreBranch.java:586)

at org.apache.jackrabbit.oak.plugins.document.DocumentNodeStoreBranch.withCurrentBranch(DocumentNodeStoreBranch.java:307)

at org.apache.jackrabbit.oak.plugins.document.DocumentNodeStoreBranch.access$600(DocumentNodeStoreBranch.java:57)

at org.apache.jackrabbit.oak.plugins.document.DocumentNodeStoreBranch$Persisted.merge(DocumentNodeStoreBranch.java:586)

at org.apache.jackrabbit.oak.plugins.document.DocumentNodeStoreBranch.merge0(DocumentNodeStoreBranch.java:182)

at org.apache.jackrabbit.oak.plugins.document.DocumentNodeStoreBranch.merge(DocumentNodeStoreBranch.java:118)

at org.apache.jackrabbit.oak.plugins.document.DocumentRootBuilder.merge(DocumentRootBuilder.java:159)

at org.apache.jackrabbit.oak.plugins.document.DocumentNodeStore.merge(DocumentNodeStore.java:1653)

at org.apache.jackrabbit.oak.core.MutableRoot.commit(MutableRoot.java:247)

at org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.commit(SessionDelegate.java:347)

at org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.save(SessionDelegate.java:494)

... 25 common frames omitted

I really appreciate for any suggestion here!

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

Hi,

> Caused by: javax.jcr.InvalidItemStateException: OakState0002: Conflicting concurrent change on branch commits [r16126faf91f-0-4, r16126fab61d-0-4, r16126f66a91-0-4, ....]

That's the problem. You have 2 sessions which want to change the same thing at a time. Given the stacktrace it's not apparent at which area this happens. Could it be that the replication agent updates the replication status in the meanwhile while your session is still open?

Enable JCR write logging can help you to pinpoint the thread which is writing at the same location: What is writing to my Oak repository? | Things on a content management system

Jörg

View solution in original post

2 Replies

Avatar

Correct answer by
Employee Advisor

Hi,

> Caused by: javax.jcr.InvalidItemStateException: OakState0002: Conflicting concurrent change on branch commits [r16126faf91f-0-4, r16126fab61d-0-4, r16126f66a91-0-4, ....]

That's the problem. You have 2 sessions which want to change the same thing at a time. Given the stacktrace it's not apparent at which area this happens. Could it be that the replication agent updates the replication status in the meanwhile while your session is still open?

Enable JCR write logging can help you to pinpoint the thread which is writing at the same location: What is writing to my Oak repository? | Things on a content management system

Jörg

Avatar

Level 2

Hi  Jörg Hoh​,

                      thanks for your quick reply here. I set up this log, analyze and update here.

Thanks & Regards,

Radhakrishna.