Le 08/01/2019 à 23:25, PiBa-NL a écrit :
Hi Frederic,

Op 7-1-2019 om 10:13 schreef Frederic Lecaille:
On 12/23/18 11:38 PM, PiBa-NL wrote:
As requested hereby the regtest send for inclusion into the git
repository.
It is OK like that.

Note that you patch do not add reg-test/filters/common.pem which could
be a symlink to ../ssl/common.pem.
Also note that since 8f16148Christopher's commit, we add such a line
where possible:
     ${no-htx} option http-use-htx
We should also rename your test files to reg-test/filters/h00000.*
Thank you.
Fred.

Together with these changes you have supplied me already off-list, i've
also added a " --max-time 15" for the curl request, that should be
sufficient for most systems to complete the 3 second testcase, and
allows the shell command to complete without varnishtest killing it
after a timeout and not showing any of the curl output..

One last question, currently its being added to a new folder:
reg-test/filters/ , perhaps it should be in reg-test/compression/ ?
If you agree that needs changing i guess that can be done upon
committing it?

Note that the test fails on my FreeBSD system when using HTX when using
'2.0-dev0-251a6b7 2019/01/08', i'm not aware it ever worked (i didn't
test it with HTX before..).
**** top  15.2 shell_out|curl: (28) Operation timed out after 15036
milliseconds with 187718 bytes received

Log attached.. Would it help to log it with the complete "filter trace
name BEFORE / filter compression / filter trace name AFTER" ? Or are
there other details i could try and gather?


Hi Pieter,

I finally reproduced the bug on FreeBSD and also on Linux, adding "tune.sndbuf.client 4096" in the global section.

It is unrelated to the compression. It is a bug in the LUA part. Here is the patch to fix the bug. It is already merged.

Thanks,
--
Christopher Faulet
>From 4893977665049d159d76077e7276a9e98f54c317 Mon Sep 17 00:00:00 2001
From: Christopher Faulet <cfau...@haproxy.com>
Date: Wed, 9 Jan 2019 12:16:58 +0100
Subject: [PATCH] BUG/MINOR: lua/htx: Respect the reserve when data are send
 from an HTX applet

In the function hlua_applet_htx_send_yield(), there already was a test to
respect the reserve but the wrong function was used to get the available space
for data in the HTX buffer. Instead of calling htx_free_space(), the function
htx_free_data_space() must be used. But in fact, there is no reason to bother
with that anymore because the function channel_htx_recv_max() has been added for
this purpose.

The result of this bug is that the call to htx_add_data() failed unexpectedly
while the amount of written data was incremented, leading the applet to think
all data was sent. To prevent any futher bugs, a test has been added to yield if
we are not able to write data into the channel buffer.

This patch must be backported to 1.9.
---
 src/hlua.c | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/src/hlua.c b/src/hlua.c
index ca51477c4..b9df9265f 100644
--- a/src/hlua.c
+++ b/src/hlua.c
@@ -4622,14 +4622,9 @@ __LJMP static int hlua_applet_htx_send_yield(lua_State *L, int status, lua_KCont
 	int l = MAY_LJMP(luaL_checkinteger(L, 3));
 	int max;
 
-	max = htx_free_space(htx);
-        if (channel_recv_limit(res) < b_size(&res->buf)) {
-                if (max < global.tune.maxrewrite) {
-			si_rx_room_blk(si);
-			MAY_LJMP(hlua_yieldk(L, 0, 0, hlua_applet_htx_send_yield, TICK_ETERNITY, 0));
-		}
-                max -= global.tune.maxrewrite;
-        }
+	max = channel_htx_recv_max(res, htx);
+	if (!max)
+		goto snd_yield;
 
 	data = MAY_LJMP(luaL_checklstring(L, 2, &len));
 
@@ -4638,8 +4633,9 @@ __LJMP static int hlua_applet_htx_send_yield(lua_State *L, int status, lua_KCont
 		max = len - l;
 
 	/* Copy data. */
-	htx_add_data(htx, ist2(data + l, max));
-	res->total += l;
+	if (!htx_add_data(htx, ist2(data + l, max)))
+		goto snd_yield;
+	res->total += max;
 	res->flags |= CF_READ_PARTIAL;
 	htx_to_buf(htx, &res->buf);
 
@@ -4652,6 +4648,7 @@ __LJMP static int hlua_applet_htx_send_yield(lua_State *L, int status, lua_KCont
 	 * applet, and returns a yield.
 	 */
 	if (l < len) {
+	  snd_yield:
 		si_rx_room_blk(si);
 		MAY_LJMP(hlua_yieldk(L, 0, 0, hlua_applet_htx_send_yield, TICK_ETERNITY, 0));
 	}
-- 
2.20.1

Reply via email to