We are running liquibase concurrently to patch multiple databases using the same migration file. The liquibase version is 3.10.0. The database is Azure Sql. The exception is thrown in liquibase.executor.ExecutorService.getExecutor (line 93). The reason is multiple threads try to populate the none-threadsafe HashMap for the same key. This should be easily fixed by using a ConncurrentHashMap.
public class ExecutorService {
private static ExecutorService instance = new ExecutorService();
private List<Executor> registry = new ArrayList<>();
private Map<String, Executor> executors = new HashMap<>();
Below is the stack trace.
! java.util.ConcurrentModificationException: null
! at java.base/java.util.HashMap.computeIfAbsent(HashMap.java:1134)
! at liquibase.executor.ExecutorService.getExecutor(ExecutorService.java:93)
[script-executor] Script completed with exit code: 1.
! at liquibase.database.AbstractJdbcDatabase.getConnectionSchemaName(AbstractJdbcDatabase.java:359)
! at liquibase.database.AbstractJdbcDatabase.getDefaultSchemaName(AbstractJdbcDatabase.java:324)
! at liquibase.changelog.ChangeLogParameters.<init>(ChangeLogParameters.java:61)
! at liquibase.Liquibase.<init>(Liquibase.java:109)
! at io.dropwizard.migrations.CloseableLiquibase.<init>(CloseableLiquibase.java:21)
! at io.dropwizard.migrations.CloseableLiquibaseWithClassPathMigrationsFile.<init>(CloseableLiquibaseWithClassPathMigrationsFile.java:19)
[go] Task status: failed, took: 43.334s
! at io.dropwizard.migrations.AbstractLiquibaseCommand.openLiquibase(AbstractLiquibaseCommand.java:82)
! at io.dropwizard.migrations.AbstractLiquibaseCommand.run(AbstractLiquibaseCommand.java:67)