timeoutSeconds / responseTimeoutSeconds not working + whats the difference?
Hello,
I tried to understand from the documentation the difference between timeoutSeconds and responseTimeoutSeconds, but couldn't. I would appreciate if someone can explain whats the difference exactly.
my required flow is as follows:
- task is polled by worker
- worker sends ack that he received the task
- worker machine crashes
- worker come back to life
- after 10 seconds without any result status of 'COMPLETED', the task would be retried
- task is polled (again) by worker ... ... this process would happen again and again up to 3 times, or until 'COMPLETED' status is reported
I'm really not sure if the field i'm looking for is responseTimeoutSecondsor, timeoutSeconds, or both. I tried both. and I tried separately, but It didn't work.. the task is never retried and polled again.
my task definition:
[
{
"name": "task-a",
"retryCount": 3,
"timeoutSeconds": 10,
"responseTimeoutSeconds": 10,
"inputKeys": ["date"],
"outputKeys": ["year"],
"timeoutPolicy": "RETRY",
"retryLogic": "FIXED",
"retryDelaySeconds": 5
}
]`
From the documentation:
timeoutSeconds: Time in milliseconds, after which the task is marked as TIMED_OUT if not completed after transitioning to IN_PROGRESS status for the first time
responseTimeoutSeconds: If greater than 0, the task is rescheduled if not updated with a status after this time (heartbeat mechanism). Useful when the worker polls for the task but fails to complete due to errors/network failure.
Both timeout setting should work and your task should be timed out eventually, but not exactly after 10 seconds because it may take sometime for WorkflowSweeper which handles timeouts to pick it up from decider queue.
@cyzhao thanks for your reply. I read the documentation you quoted before posting this issue.. but I still don't understand the difference.
if a worker is pulling a task (and sends ACK), the status turns to IN_PROGRESS, so timeoutSeconds should take effect if the worker failed to report a completion status.
however, since there is no update with a status, responseTimeoutSeconds should also take effect.
so both take effect? if so, what's the difference?
and anyway, I tried both, together and separated, and still the task wasn't re-scheduled for additional fetching, but stayed "IN_PROGRESS" forever.
I would appreciate if you re-open the issue, as it seems like a bug or misunderstanding. thank you
@LiranBri responseTimeoutSeconds and timeoutSeconds work fine with our deployment, please check whether WorkflowSweeper is running by checking server logs, look for this logging statement:
logger.debug("Sweeper retrieved {} workflows from the decider queue.", retrievedWorkflows);
responseTimeoutSeconds works when worker gets the task but fails to respond within timeout and it resets whenever worker updates the task to any state, timeoutSeconds kicks in as soon as task is in IN_PROGRESS state, and it doesn't get reset if worker updates the task to IN_PROGRESS state with callbackAfterSeconds which can happen many times for some use cases.
@cyzhao I don't have any such log message (this or other- the last log message is just "ready to serve
note that I also tried with timeoutSeconds instead of responseTimeoutSeconds- and got the same behavior. also note that when I tried timeoutSeconds, and looked in the UI at the json of the task, it didn't specify "timeoutSeconds" there. in addition, in the docs it says "Time in milliseconds" even though the name suggests its "seconds" .. so one of them is probably wrong or misleading
for your convenience, here are the exact curl commands to reproduce the bug:
- create the task definition
curl -X POST \
http://localhost:8080/api/metadata/taskdefs \
-H 'Content-Type: application/json' \
-d '[
{
"name": "retry-task",
"retryCount": 1,
"responseTimeoutSeconds": 10,
"inputKeys": ["date"],
"outputKeys": ["year"],
"timeoutPolicy": "RETRY",
"retryLogic": "FIXED",
"retryDelaySeconds": 0
}
]'
- create the workflow definition
curl -X POST \
http://localhost:8080/api/metadata/workflow \
-H 'Content-Type: application/json' \
-d '{
"name": "retry-task",
"description": "Gets date and returns year from it",
"version": 1,
"tasks": [
{
"name": "retry-task",
"taskReferenceName": "retry-task",
"type": "SIMPLE",
"inputParameters": {
"date": "${workflow.input.date}"
}
}
],
"outputParameters": {
},
"schemaVersion": 2
}'
- start a new workflow instance
curl -X POST \
http://localhost:8080/api/workflow/retry-task \
-H 'Content-Type: application/json' \
-d '{"date": "1800-01-01"}'
- poll pending task as worker (move it to IN_PROGRESS)
curl -X GET \
'http://localhost:8080/api/tasks/poll/batch/retry-task?count=1&timeout=1000&workerid=postman' \
-H 'Content-Type: application/json' \
- send ack as worker (take task id from previous response)
curl -X POST \
http://localhost:8080/api/tasks/e134b6c8-7221-42a4-ab2f-9c3c382ab14a/ack \
-H 'Content-Type: application/json' \
- no matter how much time I wait, task is still in status IN_PROGRESS, and if I repeat step (4) to poll pending tasks I get an empty response
If i can do anything else to help investigate this, please let me know
@LiranBri Seems your task definition not config the timeout like "timeoutSeconds": 20, as I know once you config this parameter, when the task update status it will check the timeoutSeconds is exceed or not, if not then update task and reset this timeoutSeconds to 0, means two status transform during is exceed the timeoutSeconds or not. If I'm wrong please correct me @cyzhao
@JasperB i'm not sure what you mean.. you saying I configured it wrong? or you agree with me that it seems like a bug?
p.s I suspect that since this issue is "closed" no one watches it.. so I opened a new issue https://github.com/Netflix/conductor/issues/883 (hope its fine- if not please re-open and close the one i'll open now)