Skip to content

Commit d2d3c02

Browse files
committed
engine: dispatch: validate error flag on task creation
Signed-off-by: Eduardo Silva <[email protected]>
1 parent ce83f6a commit d2d3c02

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/flb_engine_dispatch.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ int flb_engine_dispatch(uint64_t id, struct flb_input_instance *in,
119119
struct flb_config *config)
120120
{
121121
int ret;
122+
int t_err;
122123
const char *buf_data;
123124
size_t buf_size = 0;
124125
const char *tag_buf;
@@ -153,7 +154,6 @@ int flb_engine_dispatch(uint64_t id, struct flb_input_instance *in,
153154
}
154155
if (!buf_data) {
155156
flb_input_chunk_release_lock(ic);
156-
157157
continue;
158158
}
159159

@@ -168,13 +168,17 @@ int flb_engine_dispatch(uint64_t id, struct flb_input_instance *in,
168168
task = flb_task_create(id, buf_data, buf_size,
169169
ic->in, ic,
170170
tag_buf, tag_len,
171-
config);
171+
config, &t_err);
172172
if (!task) {
173173
/*
174-
* If task creation failed, restore the input chunk to it non
175-
* busy state.
174+
* If task creation failed, check the error status flag. An error
175+
* is associated with memory allocation or exhaustion of tasks_id,
176+
* on that case the input chunk must be preserved and retried
177+
* later. So we just release it busy lock.
176178
*/
177-
flb_input_chunk_release_lock(ic);
179+
if (t_err == FLB_TRUE) {
180+
flb_input_chunk_release_lock(ic);
181+
}
178182
continue;
179183
}
180184
}

0 commit comments

Comments
 (0)