GString *out;
unsigned int total = 0;
unsigned int n_groups = 0;
- unsigned int overflow_groups = 0;
+ /* Events that did not fit into the first RSPAMD_DUMP_MAX_GROUPS groups —
+ * these may belong to any number of distinct groups; we cannot tell without
+ * spending more memory, so we just report the event count. */
+ unsigned int overflow_events = 0;
unsigned int i;
struct dump_group {
g->count = 0;
}
else {
- overflow_groups++;
+ overflow_events++;
}
}
rspamd_printf_gstring(out, "=%ud", g->count);
}
- if (overflow_groups > 0) {
- rspamd_printf_gstring(out, ", (+%ud more groups)", overflow_groups);
+ if (overflow_events > 0) {
+ rspamd_printf_gstring(out, ", (+%ud events not shown)", overflow_events);
}
return out;
unsigned int nargs;
char **args;
gsize *arglens;
+ /* NUL-terminated copy of args[0] for diagnostic labels; args[0] itself is
+ * sized to arglens[0] and is not NUL-terminated */
+ char *cmd;
struct lua_redis_userdata *common_ud;
struct lua_redis_ctx *ctx;
struct lua_redis_request_specific_userdata *next;
LL_FOREACH_SAFE(ud->specific, cur, tmp)
{
lua_redis_free_args(cur->args, cur->arglens, cur->nargs);
+ g_free(cur->cmd);
if (cur->cbref != -1) {
luaL_unref(ud->cfg->lua_state, LUA_REGISTRYINDEX, cur->cbref);
lua_gettable(L, -2);
cmd = lua_tostring(L, -1);
lua_pop(L, 1);
+ sp_ud->cmd = g_strdup(cmd);
lua_pushstring(L, "timeout");
lua_gettable(L, 1);
rspamd_session_add_event_full(ud->s,
lua_redis_fin, sp_ud,
M,
- sp_ud->nargs > 0 ? sp_ud->args[0] : NULL);
+ sp_ud->cmd);
if (ud->item) {
rspamd_symcache_item_async_inc(ud->task, ud->item, M);
}
sp_ud->ctx = ctx;
+ sp_ud->cmd = g_strdup(cmd);
lua_redis_parse_args(L, args_pos, cmd, &sp_ud->args,
&sp_ud->arglens, &sp_ud->nargs);
lua_redis_fin,
sp_ud,
M,
- sp_ud->nargs > 0 ? sp_ud->args[0] : NULL);
+ sp_ud->cmd);
if (ud->item) {
rspamd_symcache_item_async_inc(ud->task, ud->item, M);