Deadlocks can occur on schema parsing, due to synchronized blocks.
In our case a GeoServer instance parses a remote XSD schema. The schema is hosted by the same GeoServer instance. Before loading the schema the GeoServer synchronizes on the Schemas class. Concurrently the same GeoServer creates the schema, using a different thread and tries to synchronize on the same Schemas class -> deadlock.
In addition to the deadlock problem this is a scalability issue: The synchronized lock is held longer than required.
Proposed solution: The loading of a remote schema should be splitted into
- prefetching the schema - does not require synchronization
- loading the prefetched schema - requires synchronization to preserve data structure consistency
I will create a corresponding pull request.
PS: The deadlock is typically resolved by a readTimeout (10s by default) on the consumer side. So, in fact it is a performance bottleneck and scalability issue only.