Commit 90f72d63 authored by Marek Vavruša's avatar Marek Vavruša

worker: fixed infinite loop on send failure

The problem here is when qr_task_send() returns an error, the
following error handler will attempt to cancel all tasks that were
started on the same connection, but that will only work for the first
task (which is finished), the qr_task_on_send() will have no effect
on tasks in progress as the passed handle is NULL, and the task->finished
is false, thus looping infinitely.

The solution here is to let the rest of the tasks complete, even though
sending answer back will fail (which is fine).
parent f744757c
Pipeline #35427 passed with stages
in 13 minutes and 5 seconds
......@@ -1528,11 +1528,7 @@ static int qr_task_finalize(struct qr_task *task, int state)
(struct sockaddr *)&ctx->source.addr,
ctx->req.answer);
if (res != kr_ok()) {
while (source_session->tasks.len > 0) {
struct qr_task *t = source_session->tasks.at[0];
(void) qr_task_on_send(t, NULL, kr_error(EIO));
}
session_close(source_session);
(void) qr_task_on_send(task, NULL, kr_error(EIO));
} else if (handle->type == UV_TCP) {
/* Don't try to close source session at least
* retry_interval_for_timeout_timer milliseconds */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment