conductor-oss / conductor-oss/conductor

HttpTask readTimeOut configuration from task input does not work, readTimeOut always max to default 3 minutes

Open
#580 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
Java
Stars
32.2k
Forks
1k
Avg merge
2d 5h
Merged PRs (30d)
41

Description

**Describe the bug**
Create a http task to call some url and this url will block to response for a long time. 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

**Details**
Conductor version: 3.21.18
Persistence implementation: Postgres
Queue implementation: Postgres
Lock: Redis
Workflow definition:
Task definition:
Event handler definition:

**To Reproduce**
test case like following:

@GetMapping("test")
public String test() {
StopWatch stopWatch = new StopWatch("http task run time statistic");
stopWatch.start("task started at " + LocalDateTime.now());
System.out.println("task started at " + LocalDateTime.now());
try {
HttpTask.Input input = this.objectMapper.readValue("{ \"headers\": {}, \"method\": \"POST\", \"readTimeOut\": 300000, \"body\": { \"nextExecute1\": null, \"preV2\": null, \"preV1\": null, \"retryNum\": \"10\", \"test\": \"false\", \"extendParam\": null, \"param\": \"aabb\", \"orderRequestTaskId\": \"ba7870be-67e6-4fee-8bf1-25987c3433d9\", \"platform\": \"SELF\", \"retrySleepTime\": \"3600000\", \"nextExecute2\": null }, \"uri\": \"http://xxx.com/iac/v1/execute/cxxx\", \"connectionTimeOut\": 3600000 }", HttpTask.Input.class);
RestTemplate restTemplate = this.restTemplateProvider.getRestTemplate(input);
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.valueOf(input.getContentType()));
headers.setAccept(Collections.singletonList(MediaType.valueOf(input.getAccept())));
input.getHeaders().forEach(
(key, value) -> {
if (value != null) {
headers.add(key, value.toString());
}
});
HttpEntity request = new HttpEntity<>(input.getBody(), headers);
ResponseEntity responseEntity =
restTemplate.exchange(
input.getUri(),
HttpMethod.valueOf(input.getMethod()),
request,
String.class);
} catch (Exception e) {
System.out.println(e);
}
stopWatch.stop();
System.out.println(stopWatch.prettyPrint());
return "test";
}

**Expected behavior**
It should timeout in 5 minutes but in fact is 3 minutes by the default config of HttpComponentsClientHttpRequestFactory

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Additional context**
Add any other context about the problem here.

Contributor guide

Open the contributing guide

Research direction

Start at HttpTask.Input and restTemplateProvider.getRestTemplate(input), then trace how HttpComponentsClientHttpRequestFactory applies the timeout values. Reproduce the supplied POST case with readTimeOut set to 300000 ms and verify that the request honors five minutes rather than the three-minute default.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring-boot
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.