RaigorJiang opened a new issue #12806:
URL: https://github.com/apache/shardingsphere/issues/12806


   ## Bug Report
   
   ### Which version of ShardingSphere did you use?
   ShardingSphere-Proxy 5.0.0-RC1 : master branch
   
   ### Reason analyze (If you can)
   Error log:
   ```
   java.util.ConcurrentModificationException: null
           at 
java.util.LinkedHashMap$LinkedHashIterator.nextNode(LinkedHashMap.java:719)
           at 
java.util.LinkedHashMap$LinkedKeyIterator.next(LinkedHashMap.java:742)
           at 
java.util.AbstractCollection.finishToArray(AbstractCollection.java:232)
           at java.util.AbstractCollection.toArray(AbstractCollection.java:143)
           at java.util.ArrayList.<init>(ArrayList.java:178)
           at 
org.apache.shardingsphere.proxy.backend.context.ProxyContext.getAllSchemaNames(ProxyContext.java:98)
           at 
org.apache.shardingsphere.proxy.backend.text.database.CreateDatabaseBackendHandler.check(CreateDatabaseBackendHandler.java:46)
           at 
org.apache.shardingsphere.proxy.backend.text.database.CreateDatabaseBackendHandler.execute(CreateDatabaseBackendHandler.java:38)
   ```
   
   The reason is that the structure of metaDataMap is `LinkedHashMap`. If other 
threads modify the data during iteration, an exception will be thrown.
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule 
configuration, when exception occur etc.
   Execute the following script to quickly create  databases:
   ```bash
   #!/bin/bash
   PROXY="mysql -uroot -proot -h127.0.0.1 -P3307"
   
   for i in {10..1000}
   do
           ${PROXY} -e "CREATE SCHEMA IF NOT EXISTS sharding_test_${i}_db;"
   done
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to