-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Make jib-core a parent-first dependency #34873
Conversation
Done in order to avoid problems with Jib's use of lock classes which have no effect when the lock class is loaded from different ClassLoaders Fixes: quarkusio#11903
FTR, I have not forgotten about this but other things got/are getting in the way. |
No worries, whenever you have time |
I'm sorry but I have to report that this change is not fixing the OverlappingFileLockException in a multi-threaded Maven build. I might be totally wrong here but AFAICS, if there is not also a "vanilla" lock in jib ( |
I didn't really look at what the Jib code does, I just assumed that it was using a class lock, hence the proposed change. In any case, thanks for checking, I'll close this and we should probably implement your suggestion about running our Jib code in a lock (definitely not great, but I don't see what else we can do...) |
Ha, they do have a lock already: https://github.com/GoogleContainerTools/jib/blob/cbf7ae9591e0103c6dd6bd249a6b3c0e1dad9329/jib-core/src/main/java/com/google/cloud/tools/jib/filesystem/LockFile.java#L55 So I'm wondering why your adjustment didn't work... |
Btw, I'm currently testing a very primitive PS: Doesn't work, which is not that surprising. |
Even with parent-first, I can see that |
That shouldn't happen, I'll have to actually run it. Do you have a sample multi-module application I can use? |
I'm afraid no, I'm testing with my actual corporate & closed-source project. |
🆗 |
@geoand got something for you: q_jib-parallel.zip Should fail very quickly. PS: I had to add that cache cleanup while testing my actual app build in the same kind of loop because after a while I got "no space left on device" (Ubuntu 22). Looks like another issue to me. |
Nice! |
So the reason why my parent-first change didn't do anything is because |
How did this go? |
It didn't work for the same classloading reasons. |
Yeah, that would, but so would just using any JDK class :) |
@geoand In case we'd find a "suitable" Quarkus class to lock (that was loaded by the common CL), would that be an acceptable workaround for you? |
Sure, but given that Quarkus ClassLoaders are created for each Maven build, I don't see how that could work. |
@geoand this quick hack in Object lockObj;
try {
lockObj = getClass().getClassLoader().getParent().loadClass("io.quarkus.deployment.GlobalLock");
} catch (Throwable t) {
throw new RuntimeException(t);
}
JibContainer container;
synchronized (lockObj) {
container = jibContainerBuilder.containerize(containerizer);
} This Not pretty at all, but WDYT? PS: Someone would need to check Gradle, too. |
Yeah, I think we can live with that hack. I'd rather not have any util methods though and keep this only to Jib for now and hope we never need it anywhere else |
Was going to ask about Gradle, but I see you already did 😁 |
Ok, but how? The parent CL doesn't know about the jib-deployment module. That was my first attempt, btw. 😉 |
I'd just use (semi)some random class in the deployment module |
You mean |
Correct |
Done in order to avoid problems with Jib's use of
lock classes which have no effect when the lock
class is loaded from different ClassLoaders
Fixes: #11903