You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What
Tested version: docker-java-core:3.4.0
I`ve noticed two problems when a certain error is thrown during execution of the docker-java commands (e.g image pull). If the request thread throws an Error (not an Exception!), then
the call to dockerClient.pullImageCmd() will block and hang forever, and
the error is swallowed and not visible to the application code (yet visible on System.err through the default JVM error handler for uncaught thread exceptions)
Why
The error in this case was caused by a using a wrong Docker host configuration (containing a unix socket url) on a Windows 10 machine. This leads to an java.lang.UnsatisfiedLinkError: Error looking up function 'socket' error at execute(request) in L269 of
As the catch in L277 only handles Exceptions, but not Errors, the callback.onError() method is never executing, so the CountdownLatch here is never triggered:
If it helps, i can also attach the full stacktrace :)
Proposed fix
I'd suggest catching not only Exception but also UnsatisfiedLinkError which in this case is a condition that allows regular error handling and continued operation. Searching the issues of this project, it looks like other people also got this type of error.
One might also catch Throwable, but as always this has a smell and might not be a good option for all cases. However it might still be better than swallowing the error and hanging forever.
The text was updated successfully, but these errors were encountered:
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Hi!
What
Tested version: docker-java-core:3.4.0
I`ve noticed two problems when a certain error is thrown during execution of the docker-java commands (e.g image pull). If the request thread throws an Error (not an Exception!), then
Why
The error in this case was caused by a using a wrong Docker host configuration (containing a unix socket url) on a Windows 10 machine. This leads to an
java.lang.UnsatisfiedLinkError: Error looking up function 'socket'
error atexecute(request)
in L269 ofdocker-java/docker-java-core/src/main/java/com/github/dockerjava/core/DefaultInvocationBuilder.java
Lines 269 to 279 in a1393bf
As the catch in L277 only handles Exceptions, but not Errors, the callback.onError() method is never executing, so the CountdownLatch here is never triggered:
docker-java/docker-java-api/src/main/java/com/github/dockerjava/api/async/ResultCallbackTemplate.java
Lines 79 to 81 in a1393bf
This makes the awaitCompletion() call here wait forever, although the command is not running anymore:
docker-java/docker-java-api/src/main/java/com/github/dockerjava/api/async/ResultCallbackTemplate.java
Lines 89 to 91 in a1393bf
If it helps, i can also attach the full stacktrace :)
Proposed fix
I'd suggest catching not only
Exception
but alsoUnsatisfiedLinkError
which in this case is a condition that allows regular error handling and continued operation. Searching the issues of this project, it looks like other people also got this type of error.One might also catch Throwable, but as always this has a smell and might not be a good option for all cases. However it might still be better than swallowing the error and hanging forever.
The text was updated successfully, but these errors were encountered: