snowdrop / java-buildpack-client

A simple buildpack (https://buildpacks.io/) platform implementation as a library for java..
Apache License 2.0
13 stars 7 forks source link

org.apache.hc.core5.http.NoHttpResponseException: localhost:2375 failed to respond #60

Open cmoulliard opened 1 month ago

cmoulliard commented 1 month ago

Issue

When we execute ./pack.java within the samples/hello-quarkus, we got this error

[main] INFO dev.snowdrop.buildpack.lifecycle.LifecyclePhaseFactory - - mounted /var/run/docker.sock at /var/run/docker.sock
[main] INFO dev.snowdrop.buildpack.lifecycle.LifecyclePhaseFactory - - mounted buildpack-output-qehdanxvwx at /layers
[main] INFO dev.snowdrop.buildpack.lifecycle.LifecyclePhaseFactory - - container id 3619cb8b340e26f66223169034641611c912d0f549a74d354d130cd6b09cee64
[main] INFO dev.snowdrop.buildpack.lifecycle.LifecyclePhaseFactory - - image reference 831c5292e451cf401acecb2e1e661e4d2f94c661da503c7a0b4d3a728169f993
[main] INFO dev.snowdrop.buildpack.lifecycle.phases.Restorer - - restorer container id 3619cb8b340e26f66223169034641611c912d0f549a74d354d130cd6b09cee64 will be run with uid 1002 and args [/cnb/lifecycle/restorer, -uid, 1002, -gid, 1000, -layers, /layers, -cache-dir, /cache-dir, -log-level, debug, -build-image, paketocommunity/builder-ubi-base:latest]
- restorer container id 3619cb8b340e26f66223169034641611c912d0f549a74d354d130cd6b09cee64 will be run with uid 1002 and args [/cnb/lifecycle/restorer, -uid, 1002, -gid, 1000, -layers, /layers, -cache-dir, /cache-dir, -log-level, debug, -build-image, paketocommunity/builder-ubi-base:latest]
[main] INFO dev.snowdrop.buildpack.lifecycle.phases.Restorer - - launching restorer container
[main] INFO dev.snowdrop.buildpack.lifecycle.phases.Restorer - - attaching log relay
[docker-java-stream--1039344372] ERROR com.github.dockerjava.api.async.ResultCallbackTemplate - Error during callback
java.lang.RuntimeException: org.apache.hc.core5.http.NoHttpResponseException: localhost:2375 failed to respond
        at com.github.dockerjava.httpclient5.ApacheDockerHttpClientImpl.execute(ApacheDockerHttpClientImpl.java:195)
        at com.github.dockerjava.httpclient5.ApacheDockerHttpClient.execute(ApacheDockerHttpClient.java:9)
        at com.github.dockerjava.core.DefaultInvocationBuilder.execute(DefaultInvocationBuilder.java:228)
        at com.github.dockerjava.core.DefaultInvocationBuilder.lambda$executeAndStream$1(DefaultInvocationBuilder.java:269)
        at java.base/java.lang.Thread.run(Thread.java:1583)
Caused by: org.apache.hc.core5.http.NoHttpResponseException: localhost:2375 failed to respond
        at org.apache.hc.core5.http.impl.io.DefaultHttpResponseParser.createConnectionClosedException(DefaultHttpResponseParser.java:87)
        at org.apache.hc.core5.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:243)
        at org.apache.hc.core5.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:53)
        at org.apache.hc.core5.http.impl.io.DefaultBHttpClientConnection.receiveResponseHeader(DefaultBHttpClientConnection.java:187)
        at org.apache.hc.core5.http.impl.io.HttpRequestExecutor.execute(HttpRequestExecutor.java:175)
        at com.github.dockerjava.httpclient5.HijackingHttpRequestExecutor.execute(HijackingHttpRequestExecutor.java:50)
        at org.apache.hc.core5.http.impl.io.HttpRequestExecutor.execute(HttpRequestExecutor.java:218)
        at org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager$InternalConnectionEndpoint.execute(PoolingHttpClientConnectionManager.java:596)
        at org.apache.hc.client5.http.impl.classic.InternalExecRuntime.execute(InternalExecRuntime.java:215)
        at org.apache.hc.client5.http.impl.classic.MainClientExec.execute(MainClientExec.java:107)
        at org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
        at org.apache.hc.client5.http.impl.classic.ExecChainElement$1.proceed(ExecChainElement.java:57)
        at org.apache.hc.client5.http.impl.classic.ConnectExec.execute(ConnectExec.java:181)
        at org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
        at org.apache.hc.client5.http.impl.classic.ExecChainElement$1.proceed(ExecChainElement.java:57)
        at org.apache.hc.client5.http.impl.classic.ProtocolExec.execute(ProtocolExec.java:172)
        at org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
        at org.apache.hc.client5.http.impl.classic.ExecChainElement$1.proceed(ExecChainElement.java:57)
        at org.apache.hc.client5.http.impl.classic.HttpRequestRetryExec.execute(HttpRequestRetryExec.java:93)
        at org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
        at org.apache.hc.client5.http.impl.classic.ExecChainElement$1.proceed(ExecChainElement.java:57)
        at org.apache.hc.client5.http.impl.classic.ContentCompressionExec.execute(ContentCompressionExec.java:128)
        at org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
        at org.apache.hc.client5.http.impl.classic.ExecChainElement$1.proceed(ExecChainElement.java:57)
        at org.apache.hc.client5.http.impl.classic.RedirectExec.execute(RedirectExec.java:116)
        at org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
        at org.apache.hc.client5.http.impl.classic.InternalHttpClient.doExecute(InternalHttpClient.java:178)
        at org.apache.hc.client5.http.impl.classic.CloseableHttpClient.execute(CloseableHttpClient.java:67)
        at com.github.dockerjava.httpclient5.ApacheDockerHttpClientImpl.execute(ApacheDockerHttpClientImpl.java:191)
        ... 4 more

If I re-execute the command ./pack.java, then error is gone. Really strange !!

Useful information

Branch/PR: `platform-12`
Java JDK: 17.0.11
Podman: 5.0.2 rootful

@BarDweller

BarDweller commented 3 weeks ago

@cmoulliard I'm unable to recreate this, and I haven't seen the integration tests report this either

The stack trace indicates that localhost:2375 doesn't answer..

That isn't a host/port configured in the quarkus-sample, but it is a port normally used by docker when communicating via tcp, have you altered pack.java locally? what configuration are you attempting to build with? (eg, DOCKER_HOST value, podman/docker version)

The log above indicates it's mounting in /var/run/docker.sock (expected as the destination image doesn't contain a registry reference).. so it's unclear why the container would be choosing to use tcp via localhost:2375 .. It's getting all the way through the restorer phase too, which is a fair way thru the build, yet I'm guessing this error didn't occur before that, which is odd, as there's nothing special about restorer that would cause it to access the daemon differently..

If this is repeatable for you, it might be interesting to capture more trace to figure out what the root cause is.

cmoulliard commented 3 weeks ago

That isn't a host/port configured in the quarkus-sample, but it is a port normally used by docker when communicating via tcp, have you altered pack.java locally? what configuration are you attempting to build with? (eg, DOCKER_HOST value, podman/docker version)

This issue occurs from time to time. I got it the first time I executed ./pack.java with the Spring Boot hello sample, podman 5.0.3 and DOCKER_HOST="unix:///var/run/docker.sock" but not the second time :-(