BUG/MINOR: cache: Remove incomplete entries from the cache when stream is closed
When a stream is interrupted by the client before the full answer is
stored in the cache, we end up with an incomplete entry in the cache
that cannot be overwritten until it "naturally" expires. In such a case,
we call the cache filter's cache_store_strm_deinit callback without ever
calling cache_store_http_end which means that the 'complete' flag is
never set on the concerned cache_entry.
This patch adds a check on the 'complete' flag in the strm_deinit
callback and removes the entry from the cache if it is incomplete.
A way to exhibit this bug is to try to get the same "big" response on
multiple clients at the same time thanks to h2load for instance, and to
interrupt the client side before the answer can be fully stored in the
cache.
This patch can be backported up to 2.4 but it will need some rework
starting with branch 2.8 because of the latest cache changes.
(cherry picked from commit 23c810d04244166a1a205de510b898cf8bba2a5c)
[cf: Adapted for 2.8]
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit f5c2470e2cd8d3c3e3665b28e3f4123184d77c3a)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 7620e3a0d81621afce18e2ec91226d15126f5138)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit f4cdfec223b96d5197056d0a45bef3d2d032541f)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
1 file changed