Richard Eckart de Castilho created UIMA-6348:
------------------------------------------------
Summary: Race-condition in TypeSystemImpl commit
Key: UIMA-6348
URL: https://issues.apache.org/jira/browse/UIMA-6348
Project: UIMA
Issue Type: Bug
Components: Core Java Framework
Reporter: Richard Eckart de Castilho
Assignee: Richard Eckart de Castilho
Fix For: 3.2.0SDK
In principle, it is possible to obtain a type object from one CAS and to use
that type object to create a feature structure in another CAS:
{code}
TypeSystemDescription tsdA = new TypeSystemDescription_impl();
tsdA.addType(MY_TYPE, "", CAS.TYPE_NAME_ANNOTATION);
TypeSystemDescription tsdB = new TypeSystemDescription_impl();
tsdB.addType(MY_TYPE, "", CAS.TYPE_NAME_ANNOTATION);
CAS casA = CasCreationUtils.createCas(tsdA, null, null, null);
CAS casB = CasCreationUtils.createCas(tsdB, null, null, null);
Type typeA = casA.getTypeSystem().getType(MY_TYPE);
Annotation annB = (Annotation) casB.createAnnotation(typeA, 0, 0);
annB.addToIndexes();
casB.removeFsFromIndexes(annB);
{code}
If both CASes have been initialized with a semantically equivalent type system,
UIMA will actually return the same type object in this case due to "typesystem
consolidation" being performed in the TypeSystemImpl. However, if we turn off
typesystem consolidation or if the type systems are different and just
incidentally use the same type names, the type object is different.
In highly concurrent situations, the synchronization in TypeSystemImpl.commit
is insufficient to ensure that the consolidated type system is always returned.
This leads to a situation where more than one type system instance with the
same type may exist.
Finally, there is a sanity check done in sorted FS indexes that the type of the
index corresponds to the type of the feature structure being removed. If type
consolidation worked, this is the case - but not if it failed due to the
insufficient synchronization
--
This message was sent by Atlassian Jira
(v8.3.4#803005)