Skip to content

Commit

Permalink
lib: fix race between flb_start and flb_destroy
Browse files Browse the repository at this point in the history
Signed-off-by: Jesse Rittner <[email protected]>
  • Loading branch information
rittneje authored and nokute78 committed Jul 25, 2021
1 parent 96cf62a commit 3174392
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/flb_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,8 @@ int flb_start(flb_ctx_t *ctx)
fd = event->fd;
bytes = flb_pipe_r(fd, &val, sizeof(uint64_t));
if (bytes <= 0) {
pthread_cancel(tid);
pthread_join(tid, NULL);
ctx->status = FLB_LIB_ERROR;
return -1;
}
Expand All @@ -679,6 +681,7 @@ int flb_start(flb_ctx_t *ctx)
}
else if (val == FLB_ENGINE_FAILED) {
flb_error("[lib] backend failed");
pthread_join(tid, NULL);
ctx->status = FLB_LIB_ERROR;
return -1;
}
Expand Down

0 comments on commit 3174392

Please sign in to comment.