mirror of
https://github.com/falcosecurity/falco.git
synced 2025-09-01 14:47:00 +00:00
fix(userspace/falco): don't hang on terminating error when multi sourcing
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
This commit is contained in:
@@ -532,14 +532,6 @@ falco::app::run_result falco::app::actions::process_events(falco::app::state& s)
|
|||||||
size_t closed_count = 0;
|
size_t closed_count = 0;
|
||||||
while (closed_count < ctxs.size())
|
while (closed_count < ctxs.size())
|
||||||
{
|
{
|
||||||
// This is shared across all running event source threads an
|
|
||||||
// keeps the main thread sleepy until one of the parallel
|
|
||||||
// threads terminates and invokes release(). At that point,
|
|
||||||
// we know that at least one thread finished running and we can
|
|
||||||
// attempt joining it. Not that this also works when only one
|
|
||||||
// event source is enabled, in which we have no additional threads.
|
|
||||||
termination_sem.acquire();
|
|
||||||
|
|
||||||
if (!res.success && !termination_forced)
|
if (!res.success && !termination_forced)
|
||||||
{
|
{
|
||||||
falco_logger::log(LOG_INFO, "An error occurred in an event source, forcing termination...\n");
|
falco_logger::log(LOG_INFO, "An error occurred in an event source, forcing termination...\n");
|
||||||
@@ -548,6 +540,14 @@ falco::app::run_result falco::app::actions::process_events(falco::app::state& s)
|
|||||||
termination_forced = true;
|
termination_forced = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This is shared across all running event source threads an
|
||||||
|
// keeps the main thread sleepy until one of the parallel
|
||||||
|
// threads terminates and invokes release(). At that point,
|
||||||
|
// we know that at least one thread finished running and we can
|
||||||
|
// attempt joining it. Not that this also works when only one
|
||||||
|
// event source is enabled, in which we have no additional threads.
|
||||||
|
termination_sem.acquire();
|
||||||
|
|
||||||
for (auto &ctx : ctxs)
|
for (auto &ctx : ctxs)
|
||||||
{
|
{
|
||||||
if (ctx.sync->finished() && !ctx.sync->joined())
|
if (ctx.sync->finished() && !ctx.sync->joined())
|
||||||
|
Reference in New Issue
Block a user