On Mon, 09 Mar 2015 22:11:56 +0100
Cyril Bonté <cyril.bo...@free.fr> wrote:

> Hi Thierry,
> 
> Le 04/03/2015 21:20, Cyril Bonté a écrit :
> > Hi Thierry,
> >
> > Le 04/03/2015 11:51, Thierry FOURNIER a écrit :
> >> Thank you Cyril for the bug repport. I join the patch that fix this
> >> issue.
> >
> > Great ! I didn't have time to investigate further.
> > I can confirm that the patch works well ;-)
> 
> I've seen new commits that have been merged on the git repository.
> The bad news are that the previous test that I reported (sending a 
> response larger than the buffer) doesn't work anymore :-/
> Resulting in :
> 
> [ALERT] 067/220744 (27176) : Lua function 'hello_world': execution timeout.


Hi cyril,

This is due to the implementation of the Lua execution timeout. This is
a system used to prevent loops in scripts. The Timeout is set by
default to 4s. You can see "tune.lua.session-timeout",
"tune.lua.task-timeout" and "tune.lua.forced-yield"

   
http://cbonte.github.io/haproxy-dconv/snapshot/configuration-1.6.html#tune.lua.session-timeout


> I've also seen this commit : "MEDIUM: lua: use the Lua-5.3 version of 
> the library" [1]
> This one may be annoying in the short term for some users, because Lua 
> 5.3 is not available in all distributions (for example debian, ubuntu, ...).
> Currently for such distributions, it requires to recompile Lua 5.3 with 
> a small patch to generate the ".so" dynamic library. For those who want 
> to make some tests, you can have a look at [2] and [3] and the patches 
> they both provide.


Arg, you're right :(. The Lua 5.3 is required for the session timeout.
In the same way, it is necessary for the "forced-yield". This system
forces a yield and permits to haproxy to get the hand for processing
other things than Lua.

With the version 5.2, this is not possible without frequently Lua error.

Maybe I can do cohabitation for 5.2 and 5.3 version. The forced yield
will be deactivated with compilation 5.2. The execution timeout remain
active. BUt, I'm not sure that is a good idea.


> Also, we'll have to :
> - modify the haproxy Makefile in order to effectively detect Lua 5.3 and 
> not 5.2 anymore (only the comment was modified)
> - modify the version check in src/hlua.c to trigger an error if the 
> version number is lesser than 503.


You're right. The patch is writed and attached.

Thank you
Thierry


> 
> [1] 
> http://www.haproxy.org/git?p=haproxy.git;a=commit;h=f90838b71a3c7f84e1d8b4ff85760a35d60c6910
> [2] http://www.linuxfromscratch.org/blfs/view/svn/general/lua.html
> [3] https://aur.archlinux.org/packages/lua53/
> 
> 
> -- 
> Cyril Bonté
> 
>From 0d2bfc50892b1b09e3eb78ebaced9c0ed4334063 Mon Sep 17 00:00:00 2001
From: Thierry FOURNIER <tfourn...@exceliance.fr>
Date: Tue, 10 Mar 2015 00:35:36 +0100
Subject: [PATCH] BUG/BUILD: lua: The strict Lua 5.3 version check is not
 done.

This patch fix the Lua library check. Only the version
5.3 or later is allowed.

This bug is added by the patch "MEDIUM: lua: use the
Lua-5.3 version of the library" with commit id

   f90838b71a3c7f84e1d8b4ff85760a35d60c6910
---
 Makefile   |    4 ++--
 src/hlua.c |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
index 1a31792..a12e4c9 100644
--- a/Makefile
+++ b/Makefile
@@ -569,9 +569,9 @@ OPTIONS_CFLAGS  += -DUSE_LUA $(if $(LUA_INC),-I$(LUA_INC))
 LUA_LD_FLAGS := $(if $(LUA_LIB),-L$(LUA_LIB))
 ifeq ($(LUA_LIB_NAME),)
 # Try to automatically detect the Lua library
-LUA_LIB_NAME := $(firstword $(foreach lib,lua5.2 lua52 lua,$(call check_lua_lib,$(lib),$(LUA_LD_FLAGS))))
+LUA_LIB_NAME := $(firstword $(foreach lib,lua5.3 lua53 lua,$(call check_lua_lib,$(lib),$(LUA_LD_FLAGS))))
 ifeq ($(LUA_LIB_NAME),)
-$(error unable to automatically detect the Lua library name, you can enforce its name with LUA_LIB_NAME=<name> (where <name> can be lua5.2, lua52, lua, ...))
+$(error unable to automatically detect the Lua library name, you can enforce its name with LUA_LIB_NAME=<name> (where <name> can be lua5.3, lua53, lua, ...))
 endif
 endif
 
diff --git a/src/hlua.c b/src/hlua.c
index 564f5ba..fb39dc1 100644
--- a/src/hlua.c
+++ b/src/hlua.c
@@ -4,8 +4,8 @@
 #include <lua.h>
 #include <lualib.h>
 
-#if !defined(LUA_VERSION_NUM) || LUA_VERSION_NUM < 502
-#error "Requires Lua 5.2 or later."
+#if !defined(LUA_VERSION_NUM) || LUA_VERSION_NUM < 503
+#error "Requires Lua 5.3 or later."
 #endif
 
 #include <ebpttree.h>
-- 
1.7.10.4

Reply via email to