BUG/MAJOR: tcp: fix a possible busy spinning loop in content track-sc*
authorWilly Tarreau <w@1wt.eu>
Wed, 30 Jul 2014 06:56:35 +0000 (08:56 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 30 Jul 2014 06:56:35 +0000 (08:56 +0200)
commit6bcb0a84e7256f00793fa8ec8a0d6c19c3b22935
tree9d1cb6f9237090b7397778f7055a4bf9b2d3a9be
parent5b5ea9c93384da49eea0f67ebed0966d4167b17a
BUG/MAJOR: tcp: fix a possible busy spinning loop in content track-sc*

As a consequence of various recent changes on the sample conversion,
a corner case has emerged where it is possible to wait forever for a
sample in track-sc*.

The issue is caused by the fact that functions relying on sample_process()
don't all exactly work the same regarding the SMP_F_MAY_CHANGE flag and
the output result. Here it was possible to wait forever for an output
sample from stktable_fetch_key() without checking the SMP_OPT_FINAL flag.
As a result, if the client connects and closes without sending the data
and haproxy expects a sample which is capable of coming, it will ignore
this impossible case and will continue to wait.

This change adds control for SMP_OPT_FINAL before waiting for extra data.
The various relevant functions have been better documented regarding their
output values.

This fix must be backported to 1.5 since it appeared there.
src/proto_tcp.c
src/sample.c
src/stick_table.c