FeatureTypeRegistry of gt-complex is not thread-safe

Description

When the WFSContentDataAccess calls getSchema from different threads, we will often get this exception. Looking at the code in createFoundationTypes it is clear that we are holding a lock for the wrong object.

java.util.ConcurrentModificationException
at java.base/java.util.HashMap.computeIfAbsent(HashMap.java:1221)
at org.geotools.data.complex.feature.type.FeatureTypeRegistry.createFoundationTypes(FeatureTypeRegistry.java:617)
at org.geotools.data.complex.feature.type.FeatureTypeRegistry.<init>(FeatureTypeRegistry.java:124)
at org.geotools.data.complex.feature.type.FeatureTypeRegistry.<init>(FeatureTypeRegistry.java:106)
at org.geotools.data.complex.feature.type.FeatureTypeRegistry.<init>(FeatureTypeRegistry.java:101)
at org.geotools.data.wfs.impl.WFSContentDataAccess.getFeatureTypeRegistry(WFSContentDataAccess.java:279)
at org.geotools.data.wfs.impl.WFSContentDataAccess.getSchema(WFSContentDataAccess.java:181)
at org.geotools.data.wfs.impl.WFSContentComplexFeatureSource.getFeatures(WFSContentComplexFeatureSource.java:97)
at org.geotools.data.wfs.impl.WFSContentComplexFeatureSource.getFeatures(WFSContentComplexFeatureSource.java:85)

Environment

None

Activity

Fixed

Details

Assignee

Reporter

Components

Fix versions

Priority

Created February 4, 2025 at 7:43 PM
Updated February 25, 2025 at 4:44 PM
Resolved February 25, 2025 at 3:19 PM