Liquibase maven thread-safety

short background, i’m trying to run the updateSQL goal under mvnd (maven daemon). i have a couple of modules in the reactor build that run this goal, and they often run in parallel. i get random (almost 50% of the time) errors where the output file is corrupted (e.g. just ends halfway through a file), or i get “Stream closed” exceptions.

i’m using liquibase 4.30.0, if that makes any difference.

i’ve been eyeballing the Scope class, and i must admit i don’t quite understand it - it seems like if at any point a thread calls Scope.getCurrentScope() then the SingletonScopeManager will be set as the scope manager and will be used by that thread and any child threads it creates. doesn’t this create a thread-safety issue when e.g. multiple child threads create child scopes, getting/setting currentScope which is shared across the ‘root’ thread and all its children?

is there a related problem when it initializes the rootScope in a SingletonScopeManager. i notice it sets it (i.e. makes it visible in the scope manager) before actually initializing it with its attributes, so it’s theoretically possible for another thread to see the rootScope but for it to have some or all of its initial values unset.