Skip to content
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

HTTP interface client should not set a default blockingTimeout value and instead let the underlying HTTP client determine the behavior #30248

Closed
pmverma opened this issue Mar 30, 2023 · 3 comments
Assignees
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) status: superseded An issue that has been superseded by another type: enhancement A general enhancement

Comments

@pmverma
Copy link

pmverma commented Mar 30, 2023

Affects: Spring Boot 3.0.5 / Spring Framework 6.0.7


As mentioned in the title, it seems the webclient timeout value does not work when using the HTTP interface.
But the same timeout value works when using the webclient directly as below.

    @EventListener
    public void onStartup(ApplicationStartedEvent event) {
        // Non-blocking, working fine
        event.getApplicationContext().getBean(WebClient.class)
                .get()
                .uri("http:https://localhost:8080/test")
                .retrieve().bodyToMono(String.class)
                .subscribe(System.out::println);

        // Blocking, working fine
        String result = event.getApplicationContext().getBean(WebClient.class)
                .get()
                .uri("http:https://localhost:8080/test")
                .retrieve().bodyToMono(String.class)
                .block();
        System.out.println(result);

        // Blocking but with HttpInterface, is failing
        SampleApi sampleApi = event.getApplicationContext().getBean(SampleApi.class);
        System.out.println(sampleApi.get().getStatusCode());
    }

I have added a minimal sample application that demonstrates the above issue.
https://github.com/pmverma/demo-http-interface-webclient-timeout

All codes are in a single file DemoHttpInterfaceWebclientTimeoutApplication.java

Regards,
Mohan

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Mar 30, 2023
@pmverma
Copy link
Author

pmverma commented Apr 3, 2023

I found that it is not related to WebClient, but HttpServiceProxyFactory itself where you can need set the .blockTimeout.

        HttpServiceProxyFactory factory = HttpServiceProxyFactory.builder(WebClientAdapter.forClient(webClient))
                .blockTimeout(Duration.ofSeconds(30))
                .build();

This should be mentioned in the documentation as this is a bit tricky.
It says the Http interface uses WebClient, but the timeout configuration for blocking calls has nothing to do with it.

@rstoyanchev rstoyanchev added the in: web Issues in web modules (web, webmvc, webflux, websocket) label Apr 11, 2023
@OlgaMaciaszek
Copy link
Contributor

Hello, @pmverma, thanks for reporting this. Although the blocking timeout settings were set there on purpose, we realise it might be more useful and intuitive to have any timeouts being governed by the underlying HTTP clients' settings. We are going to modify it so that the blockingTimeout is null by default and only there to be set explicitly by the developers for their convenience.

@rstoyanchev rstoyanchev added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Apr 24, 2023
@rstoyanchev rstoyanchev added this to the 6.1.0-M1 milestone Apr 24, 2023
@rstoyanchev rstoyanchev changed the title Timeout values for WebClient seems not applied when using with Http Interface HTTP interface client should not set a default blockingTimeout value and let the underlying HTTP client determine the behavior Apr 24, 2023
@rstoyanchev rstoyanchev changed the title HTTP interface client should not set a default blockingTimeout value and let the underlying HTTP client determine the behavior HTTP interface client should not set a default blockingTimeout value and instead let the underlying HTTP client determine the behavior Apr 24, 2023
@rstoyanchev
Copy link
Contributor

Closing as superseded by #30403.

@rstoyanchev rstoyanchev closed this as not planned Won't fix, can't repro, duplicate, stale May 2, 2023
@rstoyanchev rstoyanchev added the status: superseded An issue that has been superseded by another label May 2, 2023
@rstoyanchev rstoyanchev removed this from the 6.1.0-M1 milestone May 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) status: superseded An issue that has been superseded by another type: enhancement A general enhancement
Projects
None yet
4 participants