Fix(http-task): readTimeOut configuration from task input does not wo… #579
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix(http-task): readTimeOut configuration from task input does not work, readTimeOut always max to default 3 minutes
Pull Request type
NOTE: Please remember to run
./gradlew spotlessApply
to fix any format violations.Changes in this PR
I wrote a test case to replay this issue:
`/*
*/
package com.netflix.conductor.tasks.http;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.http.*;
import org.springframework.util.StopWatch;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.netflix.conductor.tasks.http.providers.RestTemplateProvider;
import org.springframework.web.client.RestTemplate;
import java.time.LocalDateTime;
import java.util.Collections;
// test
@RestController
@RequestMapping("test")
public class TestHttpRequest {
protected RestTemplateProvider restTemplateProvider;
protected ObjectMapper objectMapper;
}
`
When I call a http request to http://xxx.com/iac/v1/execute/cxxx(not real path), it will block for a long time without response.
And I config readTimeOut as 300000ms (5 minutes), but after 3 minutes later, an exception throw out:
Failed to invoke HTTP task due to: java.lang.Exception: I/O error on POST request for "http://xxx.com/iac/v1/execute/cxxx": Read timed out
I think is should try to use the readTimeOut config as the old version(like 2.31.0), I know there is a timeout config for server side could also less than the readTimeOut config.
After my modification, I have tested the test case, and it worked.
Appendix, there is a setReadTimeOut function in HttpComponentsClientHttpRequestFactory in spring-framework versions >= 6.2
https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/http/client/HttpComponentsClientHttpRequestFactory.html
Describe the new behavior from this PR, and why it's needed
Issue #
Alternatives considered
Describe alternative implementation you have considered