It's all about the answers!

Ask a question

Is there a race condition in code to read custom attribute values of type enumeration?


Markus Nosse (15112828) | asked Jan 12 '15, 9:12 a.m.
All,

we have an automated client which connects to our RTC v5.0 server. Among other things, it reads custom attributes for specific work items. At times, multiple instances of this automated client access the server in parallel. These parallel accesses seem to hit a race condition:

Exception stack trace of thread 1:
 Exception message is: null

 Stack Trace: java.lang.NullPointerException
        at org.eclipse.emf.common.util.BasicEMap.entryForKey(BasicEMap.java:1390)
        at org.eclipse.emf.common.util.BasicEMap.get(BasicEMap.java:559)
        at org.eclipse.emf.common.util.BasicEMap$DelegatingMap.get(BasicEMap.java:794)
        at com.ibm.team.repository.common.model.impl.ItemImpl.getStringExtension(ItemImpl.java:1223)
        at com.ibm.team.workitem.common.internal.model.impl.WorkItemImpl.getEnumeration(WorkItemImpl.java:3764)
        at com.ibm.team.workitem.common.internal.model.impl.WorkItemImpl.getValue(WorkItemImpl.java:2858)
        at sun.reflect.GeneratedMethodAccessor117.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
        at java.lang.reflect.Method.invoke(Method.java:611)
        at com.ibm.team.repository.common.internal.util.ItemStore$ItemInvocationHandler.invoke(ItemStore.java:597)
        at com.sun.proxy.$Proxy19.getValue(Unknown Source)

Exception stack trace of thread 2:
Exception message is: null

 Stack Trace: java.lang.ArrayIndexOutOfBoundsException
        at org.eclipse.emf.common.util.BasicEList.grow(BasicEList.java:736)
        at org.eclipse.emf.common.util.BasicEList.addUnique(BasicEList.java:422)
        at org.eclipse.emf.common.util.AbstractEList.add(AbstractEList.java:307)
        at org.eclipse.emf.common.util.BasicEMap.doPut(BasicEMap.java:616)
        at org.eclipse.emf.common.util.BasicEMap.ensureEntryDataExists(BasicEMap.java:247)
        at org.eclipse.emf.common.util.BasicEMap.get(BasicEMap.java:556)
        at org.eclipse.emf.common.util.BasicEMap$DelegatingMap.get(BasicEMap.java:794)
        at com.ibm.team.repository.common.model.impl.ItemImpl.getStringExtension(ItemImpl.java:1223)
        at com.ibm.team.workitem.common.internal.model.impl.WorkItemImpl.getEnumeration(WorkItemImpl.java:3764)
        at com.ibm.team.workitem.common.internal.model.impl.WorkItemImpl.getValue(WorkItemImpl.java:2858)
        at sun.reflect.GeneratedMethodAccessor117.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
        at java.lang.reflect.Method.invoke(Method.java:611)
        at com.ibm.team.repository.common.internal.util.ItemStore$ItemInvocationHandler.invoke(ItemStore.java:597)
        at com.sun.proxy.$Proxy19.getValue(Unknown Source)

Both threads hit these exception at the very same location. Any ideas what is wrong here?
(Because the second stack trace contains method "grow", I suspected that maybe a value was written to the fied which is not defined in the enumeration type, but DB analysis shows that this is not the case.)

Thanks in advance,
Markus




Be the first one to answer this question!


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.