Skip to content

Commit 757b13d

Browse files
leonardo-albertovichedsiper
authored andcommitted
engine: added conditional to avoid re-scheduling conflict
When fluent-bit is shutting down it tries to immediately reschedule any pending retries, however, due to how scheduling works a flush task can be scheduled to run and (by signaling the appropriate pipe) then flb_engine_reschedule_retries can try to invalidate it and re-schedule it which in turn causes a problem when handle_output_event is invoked to handle the result of the flush that was supposed to be aborted because when a chunk has only one route it's always set down. This is not the optimal approach but it's the safest one within the limits of the system. Signed-off-by: Leonardo Alminana <[email protected]>
1 parent 92de130 commit 757b13d

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/flb_engine.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,15 @@ void flb_engine_reschedule_retries(struct flb_config *config)
131131
ins = mk_list_entry(head, struct flb_input_instance, _head);
132132
mk_list_foreach_safe(t_head, tmp_task, &ins->tasks) {
133133
task = mk_list_entry(t_head, struct flb_task, _head);
134+
135+
if (task->users > 0) {
136+
flb_debug("[engine] retry=%p for task %i already scheduled to run, "
137+
"not re-scheduling it.",
138+
retry, task->id);
139+
140+
continue;
141+
}
142+
134143
mk_list_foreach_safe(rt_head, tmp_retry_task, &task->retries) {
135144
retry = mk_list_entry(rt_head, struct flb_task_retry, _head);
136145
flb_sched_request_invalidate(config, retry);

0 commit comments

Comments
 (0)