BUG/MEDIUM: applet: Improve again spinning loops detection with the new API

A first attempt to fix this issue was already pushed (54b7539d6 "BUG/MEDIUM:
apppet: Improve spinning loop detection with the new API"). But it not was
fully accurrate. Indeed, we must check if something was received or sent by
the applet before incrementing the call rate. But we must also take care the
applet is allowed to receive or send data. That is what is performed in this
patch.

This patch must be backported as far as 3.0 with the patch above.
This commit is contained in:
Christopher Faulet 2025-10-16 11:22:22 +02:00
parent 7ba4b0ad5f
commit 854888497e

View File

@ -968,7 +968,7 @@ struct task *task_process_applet(struct task *t, void *context, unsigned int sta
} }
/* measure the call rate and check for anomalies when too high */ /* measure the call rate and check for anomalies when too high */
if (!did_recv && !did_send) { if ((!did_recv && sc_is_send_allowed(sc)) && (!did_send && sc_is_recv_allowed(sc))) {
rate = update_freq_ctr(&app->call_rate, 1); rate = update_freq_ctr(&app->call_rate, 1);
if (rate >= 100000 && app->call_rate.prev_ctr) // looped like this more than 100k times over last second if (rate >= 100000 && app->call_rate.prev_ctr) // looped like this more than 100k times over last second
stream_dump_and_crash(&app->obj_type, read_freq_ctr(&app->call_rate)); stream_dump_and_crash(&app->obj_type, read_freq_ctr(&app->call_rate));