-
-
Notifications
You must be signed in to change notification settings - Fork 152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Race condition in sbt-compiler-bridge jar when running multimodule project with -T #738
Comments
One possibility would be to modify this plugin's code and synchronize the compiler bridge installation. Have you tried this? |
Have not tried due to the rarity of failures and the infrastructure setup of installing a modified plugin somewhere CI can access it, but probably could just make |
acote-coveo
added a commit
to acote-coveo/scala-maven-plugin
that referenced
this issue
Apr 22, 2024
It was identified in davidB#738 that a race condition could occur when building a project using multiple threads. To mitigate the issue, I wrapped the installation of the compiler with a synchronized block on the Static instance. As a result, if multiple threads try to install the compiler at the same time, only one thread will be able to do so. When they will get unlocked, it will check if the file was created meanwhile and if so, to will early return.
slandelle
pushed a commit
that referenced
this issue
Apr 23, 2024
It was identified in #738 that a race condition could occur when building a project using multiple threads. To mitigate the issue, I wrapped the installation of the compiler with a synchronized block on the Static instance. As a result, if multiple threads try to install the compiler at the same time, only one thread will be able to do so. When they will get unlocked, it will check if the file was created meanwhile and if so, to will early return.
Closed by #759 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We have a somewhat large multi-module project using the scala-maven-plugin that we build with
-T 4
to parallelize and speed up the build process. Sometimes in CI, we get the following error on a random module (and rerunning tends to work successfully):We think what's happening is that multiple modules are attempting to compile the sbt-compiler-bridge jar and install it to ~/.sbt/1.0/zinc/org.scala-sbt, and when a later one finishes doing so, it replaces the jar that is in use by another module that's attempting to compile scala code having already referenced the existing jarfile. (in at least one failed run, 3 modules attempt and succeed in compiling and installing the bridge. Just before they do that installation, a 4th module logs out "Compiler bridge file is not installed yet" and starts to compile and install it again. Just as that module finishes installing the bridge, a separate module fails with the error above)
We've worked around this for now by adding an empty src/test/scala file in the parent pom-only module which forces the compiler bridge installation to happen before the child modules get threaded off, but would prefer not to need that ugly workaround.
The text was updated successfully, but these errors were encountered: