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 locks is held longer than required. Solutions: 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 corresponding pull request. Best regards, Andreas |