deegree/deegree3

Concurrent access issue during XML CRS configuration parsing in deegree leading to CRSConfigurationException

Opened this issue · 0 comments

We have observed a concurrent access issue during the parsing of XML CRS configuration files in deegree. Specifically, test failures have been noted in parameterized tests and asynchronously executed tests. These failures are characterized by a CRSConfigurationException caused by an XML parsing error, suggesting that the file might be incomplete or corrupted.

The error observed indicates a potential race condition and inconsistent states during XML parsing.

Stacktrace of the CRSConfigurationException:

org.deegree.cs.exceptions.CRSConfigurationException: 
com.ctc.wstx.exc.WstxParsingException: Unexpected '<' character in element (missing closing '>'?)
 at [row,col,system-id]: [15,12,"jar:file:/.../.repository/de/latlon/deegree-core-cs/3.6.0-SNAPSHOT/deegree-core-cs-3.6.0-SNAPSHOT.jar!/org/deegree/cs/persistence/deegree/d3/config/projection-definitions.xml"]
	at org.deegree.cs.persistence.deegree.d3.parsers.ProjectionParser.getProjectionForId(ProjectionParser.java:283)
	at org.deegree.cs.persistence.deegree.d3.DeegreeCRSStore.getCRSResource(DeegreeCRSStore.java:316)
	at org.deegree.cs.persistence.deegree.d3.DeegreeReferenceResolver.getObject(DeegreeReferenceResolver.java:68)
	at org.deegree.commons.tom.Reference.getReferencedObject(Reference.java:150)
	at org.deegree.cs.refs.projections.ProjectionRef.doInverseProjection(ProjectionRef.java:75)
	at org.deegree.cs.coordinatesystems.ProjectedCRS.doInverseProjection(ProjectedCRS.java:172)
	at org.deegree.cs.transformations.coordinate.ProjectionTransform.doInverseTransform(ProjectionTransform.java:220)
	at org.deegree.cs.transformations.coordinate.ProjectionTransform.doTransform(ProjectionTransform.java:135)
	at org.deegree.cs.transformations.coordinate.ConcatenatedTransform.doTransform(ConcatenatedTransform.java:112)
	at org.deegree.cs.transformations.coordinate.ConcatenatedTransform.doTransform(ConcatenatedTransform.java:112)
	at org.deegree.geometry.GeometryTransformer.transform(GeometryTransformer.java:531)
	at org.deegree.geometry.GeometryTransformer.transform(GeometryTransformer.java:483)
	at org.deegree.geometry.GeometryTransformer.transform(GeometryTransformer.java:304)
	at org.deegree.geometry.GeometryTransformer.transform(GeometryTransformer.java:270)
	at org.deegree.geometry.GeometryTransformer.transform(GeometryTransformer.java:170)
	...
Caused by: com.ctc.wstx.exc.WstxParsingException: Unexpected '<' character in element (missing closing '>'?)
 at [row,col,system-id]: [15,12,"jar:file:/.../.repository/de/latlon/deegree-core-cs/3.6.0-SNAPSHOT/deegree-core-cs-3.6.0-SNAPSHOT.jar!/org/deegree/cs/persistence/deegree/d3/config/projection-definitions.xml"]
	at com.ctc.wstx.sr.StreamScanner.constructWfcException(StreamScanner.java:634)
	at com.ctc.wstx.sr.StreamScanner.throwParseError(StreamScanner.java:504)
	at com.ctc.wstx.sr.StreamScanner.throwParseError(StreamScanner.java:488)
	at com.ctc.wstx.sr.BasicStreamReader.handleNsAttrs(BasicStreamReader.java:3075)
	at com.ctc.wstx.sr.BasicStreamReader.handleStartElem(BasicStreamReader.java:3030)
	at com.ctc.wstx.sr.BasicStreamReader.nextFromTree(BasicStreamReader.java:2908)
	at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1121)
	at org.deegree.commons.xml.stax.XMLStreamUtils.nextElement(XMLStreamUtils.java:630)
	at org.deegree.commons.xml.stax.XMLStreamUtils.moveReaderToFirstMatch(XMLStreamUtils.java:800)
	at org.deegree.cs.persistence.deegree.d3.parsers.DefinitionParser.moveReaderToNextIdentifiable(DefinitionParser.java:306)
	at org.deegree.cs.persistence.deegree.d3.parsers.ProjectionParser.parseProjection(ProjectionParser.java:126)
	at org.deegree.cs.persistence.deegree.d3.parsers.ProjectionParser.getProjectionForId(ProjectionParser.java:277)
	... 63 more

This problem suggests that the current handling of concurrent access to the CRS resources in deegree may not be robust enough, leading to potential race conditions and inconsistent states during XML parsing.