BUG/MEDIUM: filters: Be sure to call flt_end_analyze for both channels
authorChristopher Faulet <cfaulet@haproxy.com>
Thu, 6 Jul 2017 13:53:02 +0000 (15:53 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 6 Jul 2017 21:07:36 +0000 (23:07 +0200)
commit570f79987756b1534d5601b66ba68602a847ec09
tree64e3322ae1f7b3c6025ae7039d8877f94866b0b3
parenta94fda30bd5638a77ea96a1c5fca7945fe736714
BUG/MEDIUM: filters: Be sure to call flt_end_analyze for both channels

In the commit 2b553de5 ("BUG/MINOR: filters: Don't force the stream's wakeup
when we wait in flt_end_analyze"), we removed a task_wakeup in flt_end_analyze
to no consume too much CPU by looping in certain circumstances.

But this fix was too drastic. For Keep-Alive transactions, flt_end_analyze is
often called only for the response. Then the stream is paused until a timeout is
hitted or the next request is received. We need first let a chance to both
channels to call flt_end_analyze function. Then if a filter need to wait here,
it is its responsibility to wake up the stream when needed. To fix the bug, and
thanks to previous commits, we set the flag CF_WAKE_ONCE on channels to pretend
there is an activity. On the current channel, the flag will be removed without
any effect, but for the other side the analyzer will be called immediatly.

Thanks for Lukas Tribus for his detailed analysis of the bug.

This patch must be backported in 1.7 with the 2 previous ones:

  * a94fda3 ("BUG/MINOR: http: Don't reset the transaction if there are still data to send")
  * cdaea89 ("BUG/MINOR: stream: Don't forget to remove CF_WAKE_ONCE flag on response channel")
src/filters.c