Concurrent Modification Exception

Hi, I have a px to create child items whenever I add them to change notice. My px also adds the newly created items to the change order. The Px is working as expected but I see the following exception. Appreciate your inputs.
java.util.ConcurrentModificationException
java.util.ConcurrentModificationException
at com.agile.api.pc.TableIterator.checkForConcurrentModification(TableIterator.java:192)
at com.agile.api.pc.TableIterator.hasNext(TableIterator.java:55)
at com.agile.f5.CreateChildren.doAction(CreateChildren.java:77)
at com.agile.px.Extensions2$PXEventActionNode.invoke(Extensions2.java:750)
at com.agile.px.Extensions2.doCustomPXEvent(Extensions2.java:545)
at com.agile.px.Extensions2.invokeAction(Extensions2.java:247)
at com.agile.px.PxSessionBean.invokeAction(PxSessionBean.java:117)
at com.agile.px.com_agile_px_PxSession_l8vd22_EOImpl.__WL_invoke(Unknown Source)
at weblogic.ejb.container.internal.SessionRemoteMethodInvoker.invoke(SessionRemoteMethodInvoker.java:34)
at com.agile.px.com_agile_px_PxSession_l8vd22_EOImpl.invokeAction(Unknown Source)
at com.agile.soa.event.handler.PXInitiator.invoke(PXInitiator.java:102)
at com.agile.soa.event.handler.PXInitiator.invoke(PXInitiator.java:64)
at com.agile.soa.event.eventmgr.EventMgr.invokeEventHandlers(EventMgr.java:259)
at com.agile.soa.event.eventmgr.EventMgrSessionBean.sendPostEvent(EventMgrSessionBean.java:194)
at com.agile.soa.event.eventmgr.EventMgrSessionBean_naafhr_EOImpl.__WL_invoke_1(Unknown Source)
at com.agile.soa.event.eventmgr.EventMgrSessionBean_naafhr_EOImpl.__WL_invoke(Unknown Source)
at weblogic.ejb.container.internal.SessionRemoteMethodInvoker.invoke(SessionRemoteMethodInvoker.java:34)
at com.agile.soa.event.eventmgr.EventMgrSessionBean_naafhr_EOImpl.sendPostEvent(Unknown Source)
at com.agile.pc.cmserver.event.CMBatchEvent.processSOAEvents(CMBatchEvent.java:363)
at com.agile.pc.cmserver.base.TransactionInfo.afterCompletion(TransactionInfo.java:341)
at weblogic.transaction.internal.ServerSCInfo.doAfterCompletion(ServerSCInfo.java:1170)
at weblogic.transaction.internal.ServerSCInfo.callAfterCompletions(ServerSCInfo.java:1143)
at weblogic.transaction.internal.ServerTransactionImpl.callAfterCompletions(ServerTransactionImpl.java:3188)
at weblogic.transaction.internal.ServerTransactionImpl.afterCommittedStateHousekeeping(ServerTransactionImpl.java:3086)
at weblogic.transaction.internal.ServerTransactionImpl.setCommitted(ServerTransactionImpl.java:3131)
at weblogic.transaction.internal.ServerTransactionImpl.globalRetryCommit(ServerTransactionImpl.java:2908)
at weblogic.transaction.internal.ServerTransactionImpl.globalCommit(ServerTransactionImpl.java:2818)
at weblogic.transaction.internal.ServerTransactionImpl.internalCommit(ServerTransactionImpl.java:312)
at weblogic.transaction.internal.ServerTransactionImpl.commit(ServerTransactionImpl.java:260)
at weblogic.ejb.container.internal.BaseRemoteObject.postInvoke1(BaseRemoteObject.java:369)
at weblogic.ejb.container.internal.StatelessRemoteObject.postInvoke1(StatelessRemoteObject.java:20)
at weblogic.ejb.container.internal.BaseRemoteObject.__WL_postInvokeTxRetry(BaseRemoteObject.java:223)
at weblogic.ejb.container.internal.SessionRemoteMethodInvoker.invoke(SessionRemoteMethodInvoker.java:47)
at com.agile.pc.cmserver.change.ChangeSessionBean_3rbfzs_EOImpl.doBulkTableEditing(Unknown Source)
at com.agile.pc.cmserver.base.CMSessionBean.bulkTableEditing(CMSessionBean.java:8459)
at com.agile.pc.cmserver.base.CMRouteSessionBean.bulkTableEditing(CMRouteSessionBean.java:4368)
at com.agile.pc.cmserver.base.CMSessionBean.copyPasteRows(CMSessionBean.java:9127)
at com.agile.pc.cmserver.change.ChangeSessionBean_3rbfzs_EOImpl.__WL_invoke(Unknown Source)
at weblogic.ejb.container.internal.SessionRemoteMethodInvoker.invoke(SessionRemoteMethodInvoker.java:34)
at com.agile.pc.cmserver.change.ChangeSessionBean_3rbfzs_EOImpl.copyPasteRows(Unknown Source)
at com.agile.ipa.pc.CMObjectBase.copyPasteRows(CMObjectBase.java:5563)
at com.agile.ui.pcm.common.model.AbstractDataModel.addRows(AbstractDataModel.java:1597)
at com.agile.ui.pcm.common.ObjectViewHandler.addDropRowsToTable(ObjectViewHandler.java:27336)
at sun.reflect.GeneratedMethodAccessor539.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.agile.ui.web.action.ActionServlet.invokeMethod(ActionServlet.java:1073)
at com.agile.ui.web.action.ActionServlet.handleRequest(ActionServlet.java:677)
at com.agile.ui.web.action.ActionServlet.doPost(ActionServlet.java:309)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:751)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:844)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:280)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:254)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:136)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:346)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:25)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79)
at com.agile.ui.pcm.common.filter.RemoteFSRequestFilter.doFilter(RemoteFSRequestFilter.java:139)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79)
at com.agile.ui.web.filter.LoggingFilter.doFilter(LoggingFilter.java:108)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79)
at com.agile.ui.pcm.common.filter.WebClientLog.doFilter(WebClientLog.java:79)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79)
at com.jspbook.GZIPFilter.doFilter(GZIPFilter.java:21)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79)
at com.agile.ui.pcm.common.filter.SSOTicketFilter.doFilter(SSOTicketFilter.java:89)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79)
at com.agile.ui.pcm.common.filter.WebSecurityFilter.doFilter(WebSecurityFilter.java:186)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79)
at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:137)
at java.security.AccessController.doPrivileged(Native Method)
at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:315)
at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:460)
at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:120)
at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:217)
at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:81)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79)
at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:220)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3436)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3402)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:57)
at weblogic.servlet.internal.WebAppServletContext.doSecuredExecute(WebAppServletContext.java:2285)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2201)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2179)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1572)
at weblogic.servlet.provider.ContainerSupportProviderImpl$WlsRequestExecutor.run(ContainerSupportProviderImpl.java:255)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:311)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:263)

Add Comment
3 Answer(s)

Usually this happens when the Event that triggers your PX is a PRE Event.
When the change/item is being modified, if the PX tries to update one of them, this error is thrown.
Try configuring the Event px as POST event instead of PRE. In this way, the change and the item are not blocked by Agile modification and you should be able to customize them via SDK

Agile Angel Answered on June 20, 2017.
Add Comment

Thanks Antonio. My event is post synchronous and stop on error. I am still seeing this exception.

Agile User Answered on June 20, 2017.
Add Comment

@bhaskarap1 We see this happening if your or someone else have PLM open and is looking at the Object in question. It appears that Agile PLM does not put locks on Item’s themselves, but on the Table’s which are associated with each Item. Thus, only a single Session can Read OR Write a Table (Attachments, Relationships, etc.) of an Item at one time. There could be a timing issue with your PX, thus you may want to implement a Retry mechanism for obtaining the Table on the Item. You can check to see if the error is a Concurrent Modification error, and do backoff waiting, try again, and loop that a few times. It seems quite effective as there is nothing in the API to be notified when the Item is no longer locked.

Personally, I find the entire Pessimistic Locking of Items even for Read to be slightly less than impossible to work with. I have never come across a product which locks objects for read without providing any way to release those locks. One has to destroy the Session in which the Table was read in order to release the lock.

Good luck!

Agile User Answered on July 26, 2018.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.