> Hello list,
>
> I’m using HAProxy-1.6 with Lua. My use case involves a Lua extension
> library LuaSocket and I’m having problems configuring HAProxy to use
> LuaSocket.
>
> When I use LuaSocket directly in Lua everything works fine:
>
> [bowen ~]$ lua
>
> Lua 5.3.0  Copyright (C) 1994-2015 Lua.org, PUC-Rio
>
>> require("socket")
>
> table: 0x22faef0
>
>>
>
> However there are some problems when I use LuaSocket in a Lua file loaded
> by HAProxy.
>
> My config looks like:
>
> global
>
> lua-load hello.lua
>
> …
>
> …
>
> My hello.lua is very simple:
>
> require(“socket”)
>
> It’s throwing the following error:
>
> [bowen ~]$ haproxy -f config -c
>
> [ALERT] 162/193812 (5636) : parsing [config:2] : lua runtime error: error
> loading module 'socket.core' from file
> '/usr/local/lib/lua/5.3/socket/core.so':
>
> /usr/local/lib/lua/5.3/socket/core.so: undefined symbol: lua_getmetatable
>
> My environment is linux 2.6.32. LuaSocket was installed via LuaRocks
>
> Any ideas? Thanks in advance.


Hi,

I suppose that your problem is from HAProxy. I suppose that HAproxy
doesn't export its own symbols, and doesn't embbed unused symbols
from the lib lua.

In other way, how that you try can't work with HAProxy, because the
executed LUA code must be non blocking, and the LuaSocket provides
blocking acces to the network.

I suggest that you try to use the embedded HAProxy Socket. The HAProxy
Socket have the same API than the Lua Socket. Look for the documentation
of the Lua API in HAProxy:

   doc/lua-api/index.rst

or If you have sphynx installed, you can try a "make html" to build the
HTML API documention.

Thierry

>
> Best,
> Bowen
>



Reply via email to