-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
NullPointerException in DockerClientResolver
when running multiple Gradle BuildImageTask
s in parallel
#3981
Comments
Would a PR simply changing |
Another stacktrace with a slightly different error caused by what I believe is the same issue:
|
Hey @erdi, thanks for the report and investigation! I think you’re right, looks like the iterator usage of Curiosity: how often were you observing this issue in parallel builds, and were you able to verify in some way that moving the |
Thanks for getting back to me, @emmileaf. The most frequent it failed for us recently was 3 times in 9 builds, but on average you can expect one failure in every 100 builds. It's actually hard to give you a true frequency as it requires scouring through failed build logs to confirm that the failure was due to this problem, but it happens frequently enough for us to notice it's a thing and thus report it. I did not test this fix because I would need to fork, build and publish a custom version of the plugin and then apply it to our build. But I believe that It's based on logic and strong evidence:
|
Thanks for the additional info! It's helpful to know roughly how frequently the issue is encountered, and the proposed patch/rationale makes sense to me. I’ll go ahead and merge the PR. A thought for the future if the error still persists: since the exceptions seem to be thrown from iteration over |
* Fix for #3981. * Use an instance of ServiceLoader per a call to DockerClientResolver.dockerClients() rather than sharing an instance between all of them, to avoid using a ServiceLoader instance concurrently
Thanks for approving and merging, @emmileaf. Do you know if a release is planned any time soon? It would be great to be able to benefit from the two contributions I've made recently, #3993 and #3936.
I'm fairly sure that this particular issue will be solved by the fix. A |
Oh I see a release might be coming! 🎉 https://github.com/GoogleContainerTools/jib/releases/tag/v0.24.0-core |
jib-core 0.24.0 (and jib-gradle-plugin 3.3.2 for your use case) has been released with this fix! |
That's great news, thanks again, @emmileaf! |
Environment:
Description of the issue:
We have multiple projects in our Gradle build which have the jib plugin applied to them and we are using parallel execution. This means that multiple instances
com.google.cloud.tools.jib.gradle.BuildImageTask
can execute in parallel. When that happens we are sometimes seeing the following exception (stacktrace truncated to significant parts only):Expected behavior:
No NPEs being thrown when multiple instances
com.google.cloud.tools.jib.gradle.BuildImageTask
execute in parallel.Steps to reproduce:
Run multiple instances of
com.google.cloud.tools.jib.gradle.BuildImageTask
in parallel. This is a concurrency issue so it's not always reproducible.Additional Information:
I think that
com.google.cloud.tools.jib.docker.DockerClientResolver#resolve
is not thread safe yet it can be called from multiple threads by the Gradle plugin when running with parallel execution enabled. It uses a reference to a static instance ofServiceLoader
which according to its javadoc is not thread safe:The text was updated successfully, but these errors were encountered: