]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: applet: Fix conditions to detect spinning loop with the new API
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 21 Nov 2025 08:41:03 +0000 (09:41 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 21 Nov 2025 08:41:05 +0000 (09:41 +0100)
There was a mixup between read/send events and ability for an applet to
receive and send. The fix seems obvious by reading it. The call-rate must be
incremented when nothing was received from the applet while it was allowed
and nothing was sent to the applet while it was allowed.

This patch must be backported as far as 3.0.

src/applet.c

index 6878474f15fd5ce3dffab0e815a32b1538961de2..75d714c9bcc52addad2dbc1fa07b4cbd46956d54 100644 (file)
@@ -978,7 +978,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 */
-       if ((!did_recv && sc_is_send_allowed(sc)) && (!did_send && sc_is_recv_allowed(sc))) {
+       if ((!did_send && sc_is_send_allowed(sc)) && (!did_recv && sc_is_recv_allowed(sc))) {
                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
                        stream_dump_and_crash(&app->obj_type, read_freq_ctr(&app->call_rate));