From 51205a1958f5e83121deac1d4e818bd5712fe12d Mon Sep 17 00:00:00 2001 From: Olivier Houchard Date: Wed, 17 Apr 2019 19:29:35 +0200 Subject: [PATCH] BUG/MEDIUM: applets: Don't use task_in_rq(). When deciding if we want to wake the task of an applet up, don't give up if task_in_rq returns 1, as there's a race condition and another thread may run it. Instead, always attempt to task_wakeup(), at worst the task is already in the run queue, and nothing will happen. --- src/stream_interface.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/stream_interface.c b/src/stream_interface.c index 501897a84..1e50c1fc9 100644 --- a/src/stream_interface.c +++ b/src/stream_interface.c @@ -1468,9 +1468,8 @@ void si_applet_wake_cb(struct stream_interface *si) * appctx but in the case the task is not in runqueue we may have to * wakeup the appctx immediately. */ - if (!task_in_rq(si_task(si)) && - ((si_rx_endp_ready(si) && !si_rx_blocked(si)) || - (si_tx_endp_ready(si) && !si_tx_blocked(si)))) + if ((si_rx_endp_ready(si) && !si_rx_blocked(si)) || + (si_tx_endp_ready(si) && !si_tx_blocked(si))) appctx_wakeup(si_appctx(si)); }