diff --git a/src/flb_lib.c b/src/flb_lib.c index 77952119a36..d157c7700b3 100644 --- a/src/flb_lib.c +++ b/src/flb_lib.c @@ -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; } @@ -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; }