wso2 / micro-integrator

The cloud-native configuration driven runtime that helps developers implement composite microservices.
https://wso2.com/integration/
Apache License 2.0
202 stars 218 forks source link

SynapseConfiguration throws ConcurrentModificationException when removing more than 1 swagger files #3341

Closed veneerac closed 4 months ago

veneerac commented 4 months ago

java.util.ConcurrentModificationException when the MI server attempts to undeploy the faulty carbon applications. The stack trace is as follows.

ERROR {CappDeployer} - Error while deploying carbon application wso2mi4.1.0.57/repository/deployment/server/carbonapps/DisplayDevicesAPIComr_1.0.0-SNAPSHOT.car java.util.ConcurrentModificationException at java.base/java.util.LinkedHashMap$LinkedHashIterator.nextNode(LinkedHashMap.java:719) at java.base/java.util.LinkedHashMap$LinkedKeyIterator.next(LinkedHashMap.java:741) at org.apache.synapse.config.SynapseConfiguration.validateSwaggerTable(SynapseConfiguration.java:495) at

The exception occurs when it's iterating over the swaggerTable using an iterator obtained from swaggerTable.keySet().iterator(). However, it's modifying the swaggerTable while iterating over it by calling swaggerTable.remove(name) within the loop. This has led to a ConcurrentModificationException because the iterator detects that the collection has been structurally modified during iteration.