admin管理员组

文章数量:1406950

Got this issue after switching from spring boot 3.3 to 3.4. I have a Webclient configured to read data from the docker engine REST API using the unix socket:

@Bean("dockerEngineWebClient")
public WebClient dockerEngineWebClient(){
    HttpClient httpClient = HttpClient.create()
            .remoteAddress(() -> new DomainSocketAddress("/var/run/docker.sock"))
            .wiretap("reactorty.http.client.HttpClient", LogLevel.DEBUG, AdvancedByteBufFormat.TEXTUAL);
    return WebClient.builder()
            .clientConnector(new ReactorClientHttpConnector(httpClient))
            .build();
}

In 3.3.9 this works OK and i can call the api locally:

public Flux<Container> listContainers() {
    Map<String, List<String>> parameters = Map.of("all", List.of("true"));
    return toFlux(get("/containers/json", parameters), Container.class);
}

private <T> Flux<T> toFlux(WebClient.ResponseSpec spec, Class<T> elementClass) {
    return spec.bodyToFlux(elementClass)
            .onErrorResume(e -> {
                log.warn("Error when calling Docker Engine API", e);
                return Flux.empty();
            });
}

private WebClient.ResponseSpec get(String path, Map<String, List<String>> parameters) {
    MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<>(parameters);
    return dockerEngineWebClient.get()
            .uri(uriBuilder -> uriBuilder.path(path).queryParams(queryParams).build())
            .retrieve();
}

Result in 3.3.9 is a successful read:

reactorty.http.client.HttpClient     : [d25753ab] REGISTERED
reactorty.http.client.HttpClient     : [d25753ab] CONNECT: /var/run/docker.sock
reactorty.http.client.HttpClient     : [d25753ab, L: - R:/var/run/docker.sock] ACTIVE
reactorty.http.client.HttpClient     : [d25753ab-1, L: - R:/var/run/docker.sock] WRITE: 105B GET /containers/json?all=true HTTP/1.1
user-agent: ReactorNetty/1.1.27
host: localhost
accept: */*


reactorty.http.client.HttpClient     : [d25753ab-1, L: - R:/var/run/docker.sock] FLUSH
reactorty.http.client.HttpClient     : [d25753ab-1, L: - R:/var/run/docker.sock] WRITE: 0B
reactorty.http.client.HttpClient     : [d25753ab-1, L: - R:/var/run/docker.sock] FLUSH
reactorty.http.client.HttpClient     : [d25753ab-1, L: - R:/var/run/docker.sock] READ: 2048B HTTP/1.1 200 OK
Api-Version: 1.48
Content-Type: application/json
Docker-Experimental: false
Ostype: linux
Server: Docker/28.0.0 (linux)

However in 3.4.3 the request fails with HTTP status 505 and logs show HTTP/3.0 being used:

reactorty.http.client.HttpClient     : [6481bc92] REGISTERED
reactorty.http.client.HttpClient     : [6481bc92] CONNECT: /var/run/docker.sock
reactorty.http.client.HttpClient     : [6481bc92, L: - R:/var/run/docker.sock] ACTIVE
reactorty.http.client.HttpClient     : [6481bc92-1, L: - R:/var/run/docker.sock] WRITE: 113B GET /containers/json?all=true HTTP/3.0
user-agent: ReactorNetty/1.2.4-SNAPSHOT
host: localhost
accept: */*

reactorty.http.client.HttpClient     : [6481bc92-1, L: - R:/var/run/docker.sock] FLUSH
reactorty.http.client.HttpClient     : [6481bc92-1, L: - R:/var/run/docker.sock] READ: 193B HTTP/1.1 505 HTTP Version Not Supported: unsupported protocol version
Content-Type: text/plain; charset=utf-8
Connection: close

Would appreciate any hints on how to fix this for version 3.4.3

本文标签: