Hi Laurent,

I think that I catch the bug. Could you test the attached patch ?
Just for information, this patch is not ready to be published, but it fix the bug.

Thanks,
thierry

Attachment: 0001-BUGFIX.patch
Description: Binary data



On 9 Dec 2017, at 00:37, Thierry Fournier <tfourn...@arpalert.org> wrote:

Hi Laurent,

I reproduce the bug with version 1.81 without thread support. I will check for this.

Thierry

On 8 Dec 2017, at 13:05, Laurent Penot <pen...@gmail.com> wrote:

Hi list,

Having added lua to haproxy is really very very helpful, thanks a lot for this. I’m using it heavily.

I need to open a socket to get the content of a web page from my local network, and I do that every second using a task.
It’s in production use since lua is available in haproxy, and it has always worked fine (for now, production servers are using haproxy 1.7.9 and lua 5.3.4).
This task is running well on haproxy 1.7.9 and lua 5.3.4 but seems to not release memory when running on haproxy 1.8.1 with lua (either 5.3.3 or 5.3.4, result is the same)
It’s running on a centox 7 box, kernel 3.10.
Please find below the task, cfg, and result of haproxy –vv.
Do you know if I need to change something in this task to release memory with haproxy 1.8.1 ?


I removed all the unnecessary code, so here is the lua task :
function updateTest()

    local s
    local msg
    local infos

    while true do
        s = core.tcp()
        s:connect("ipv4@172.16.1.1:10011")
        s:send("GET / HTTP/1.0\r\n\r\n")

        msg = s:receive("*a")
--        if (msg ~= nil) then
--            core.Info('msg:' .. tostring(msg))
--        end
        msg = nil

        -- close conection
        s:close()
        s = nil

        infos = core.get_info()
        core.Info('PoolUsed_MB:' .. tostring(infos['PoolUsed_MB']))
        infos = nil

        core.sleep(1)
    end

end
core.register_task(updateTest)


Here is the haproxy infos:
HA-Proxy version 1.8.1 2017/12/03
Copyright 2000-2017 Willy Tarreau <wi...@haproxy.org>

Build options :
  TARGET  = linux2628
  CPU     = generic
  CC      = gcc
  CFLAGS  = -m64 -march=x86-64 -O2 -g -fno-strict-aliasing -Wdeclaration-after-statement -fwrapv -Wno-unused-label
  OPTIONS = USE_ZLIB=1 USE_REGPARM=1 USE_OPENSSL=1 USE_LUA=yes USE_DEVICEATLAS=1 USE_SYSTEMD=1 USE_STATIC_PCRE=1 USE_PCRE_JIT=1

Default settings :
  maxconn = 2000, bufsize = 16384, maxrewrite = 1024, maxpollevents = 200

Built with OpenSSL version : OpenSSL 1.0.2k  26 Jan 2017
Running on OpenSSL version : OpenSSL 1.0.2k  26 Jan 2017
OpenSSL library supports TLS extensions : yes
OpenSSL library supports SNI : yes
OpenSSL library supports : SSLv3 TLSv1.0 TLSv1.1 TLSv1.2
Built with Lua version : Lua 5.3.3
Built with DeviceAtlas support.
Built with transparent proxy support using: IP_TRANSPARENT IPV6_TRANSPARENT IP_FREEBIND
Encrypted password support via crypt(3): yes
Built with PCRE version : 8.41 2017-07-05
Running on PCRE version : 8.41 2017-07-05
PCRE library supports JIT : yes
Built with zlib version : 1.2.7
Running on zlib version : 1.2.7
Compression algorithms supported : identity("identity"), deflate("deflate"), raw-deflate("deflate"), gzip("gzip")
Built with network namespace support.

Available polling systems:
      epoll : pref=300,  test result OK
       poll : pref=200,  test result OK
     select : pref=150,  test result OK
Total: 3 (3 usable), will use epoll.

Available filters :
[SPOE] spoe
[COMP] compression
[TRACE] trace



Here is a part of the config file (defaults, timeout, … removed):
global
    chroot      /var/run/haproxy
    pidfile     /var/run/haproxy.pid
    user        haproxy
    group       haproxy
    master-worker
    lua-load /etc/haproxy/lua/test.lua


best regards
Laurent



Reply via email to