Browse Source

Improve hyperscan compiler helper logging

tags/1.1.0
Vsevolod Stakhov 8 years ago
parent
commit
2d1e80497f
2 changed files with 10 additions and 4 deletions
  1. 8
    2
      src/hs_helper.c
  2. 2
    2
      src/libserver/re_cache.c

+ 8
- 2
src/hs_helper.c View File



#ifdef HAVE_GLOB_H #ifdef HAVE_GLOB_H
#include <glob.h> #include <glob.h>
#include <libserver/rspamd_control.h>

#endif #endif


static gpointer init_hs_helper (struct rspamd_config *cfg); static gpointer init_hs_helper (struct rspamd_config *cfg);
G_STRUCT_OFFSET (struct hs_helper_ctx, max_time), G_STRUCT_OFFSET (struct hs_helper_ctx, max_time),
RSPAMD_CL_FLAG_TIME_FLOAT, RSPAMD_CL_FLAG_TIME_FLOAT,
"Maximum time to wait for compilation of a single expression"); "Maximum time to wait for compilation of a single expression");
rspamd_rcl_register_worker_option (cfg,
type,
"timeout",
rspamd_rcl_parse_struct_time,
ctx,
G_STRUCT_OFFSET (struct hs_helper_ctx, max_time),
RSPAMD_CL_FLAG_TIME_FLOAT,
"Maximum time to wait for compilation of a single expression");


return ctx; return ctx;
} }

+ 2
- 2
src/libserver/re_cache.c View File

return TRUE; return TRUE;
} }
else { else {
msg_info_re_cache (
msg_err_re_cache (
"cannot approximate %s to hyperscan", "cannot approximate %s to hyperscan",
rspamd_regexp_get_pattern (re)); rspamd_regexp_get_pattern (re));


/* We consider that as timeout */ /* We consider that as timeout */
kill (cld, SIGKILL); kill (cld, SIGKILL);
g_assert (waitpid (cld, &status, 0) != -1); g_assert (waitpid (cld, &status, 0) != -1);
msg_info_re_cache (
msg_err_re_cache (
"cannot approximate %s to hyperscan: timeout waiting", "cannot approximate %s to hyperscan: timeout waiting",
rspamd_regexp_get_pattern (re)); rspamd_regexp_get_pattern (re));
signal (SIGCHLD, SIG_IGN); signal (SIGCHLD, SIG_IGN);

Loading…
Cancel
Save