From 100f7dc950fa1fefad2d522826a794b6b9297916 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Wed, 13 Jan 2016 00:14:05 +0000 Subject: [PATCH] Add extra sleep to avoid race condition When there are no expressions to compile it is possible that hs_helper will send notice to no workers. So this sleep should resolve the most of cases where this race occurs. --- src/hs_helper.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/hs_helper.c b/src/hs_helper.c index 260d26674e..c3efb0062a 100644 --- a/src/hs_helper.c +++ b/src/hs_helper.c @@ -174,6 +174,12 @@ rspamd_rs_compile (struct hs_helper_ctx *ctx, struct rspamd_worker *worker, msg_info ("compiled %d regular expressions to the hyperscan tree", ncompiled); + /* + * Do not send notification unless all other workers are started + * XXX: now we just sleep for 5 seconds to ensure that + */ + sleep (5); + srv_cmd.type = RSPAMD_SRV_HYPERSCAN_LOADED; srv_cmd.cmd.hs_loaded.cache_dir = ctx->hs_dir; -- 2.47.3