Hi List, Thierry,

The second print_r(core.get_info()) only shows 'some' of its results and the final message never shows.. Is there some memory buffer overflow bug in there.? Possibly caused by the 'add_header' calls.. as removing those seems to fix the behaviour of the CORE2 print_r call..

Using haproxy 1.9dev, with config below on FreeBSD.

Is there a bug in my script, or is it more likely that 'something' needs fixing in the lua api / interaction? Lemme know what i can to to help track this down somehow.. I tried memory 'poisoning' in haproxy but that doesn't seem to affect any effects i'm seeing..

Regards,

PiBa-NL (Pieter)


#### Content of haproxy.conf ####

global
  nbthread 1
  lua-load /root/haproxytest/print_r.lua
  lua-load /root/haproxytest/test.lua

defaults
    mode http
    timeout connect 5s
    timeout client 30s
    timeout server 60s

frontend TestSite
    bind *:80

    acl webrequest path -m beg /webrequest
    http-request use-service lua.testitweb-webrequest if webrequest

#### Content of test.lua ####

testitweb = {}
testitweb.webrequest = function(applet)
        core.Info("################# CORE 1")
        print_r(core.get_info())
        core.Info("################# CORE 1 ^")

        local resp = ""
        print_r(core.get_info(),false,function(x)
            resp=resp..string.gsub(x,"\n","<br/>")
        end
        )
        response = "CoreInfo:"..resp

        applet:add_header("Server", "haproxy/webstats")
        applet:add_header("Content-Length", string.len(response))
        applet:add_header("Content-Type", "text/html")
        applet:add_header("Refresh", "10")
        applet:start_response()
        applet:send(response)

        core.Info("################# CORE 2")
        print_r(core.get_info())
        core.Info("################# CORE 2 ^")
    end
core.register_service("testitweb-webrequest", "http", testitweb.webrequest)


#### (partial) output ####:

First CORE1 gets printed fully until the last item of the get_state in memory, CumConns in this case (thats gets assigned random though upon each start..)

    "Uptime_sec": (number) 3
    "Pid": (number) 7848
    "CumConns": (number) 3
]
[info] 112/222621 (7848) : ################# CORE 1 ^
[info] 112/222621 (7848) : ################# CORE 2
(table) table: 0x8023ff540 [
    "CurrSslConns": (number) 0
    "Version": (string) "1.9-dev0-564d15-357"
    "SslRate": (number) 0
    "PoolAlloc_MB": (number) 0
    "Hard_maxconn": (number) 2000
    "Nbthread": (number) 1
    "CurrConns": (number) 1
    "Memmax_MB": (number) 0
    "Maxsock": (number) 4011
    "ConnRateLimit": (number) 0
    "CompressBpsIn": (number) 0
    "Process_num": (number) 1
    "node": (string) "freebsd11"
    "Idle_pct": (number) 100
    "SessRate": (number) 1
    "CompressBpsRateLim": (number) 0
    "Tasks": (number) 4
    "Release_date": [info] 112/222622 (7848) : ################# CORE 1
(table) table: 0x8023ffc80 [
    "CurrSslConns": (number) 0
    "Version": (string) "1.9-dev0-564d15-357"
    "SslRate": (number) 0
    "PoolAlloc_MB": (number) 0
    "Hard_maxconn": (number) 2000
    "Nbthread": (number) 1
    "CurrConns": (number) 1
    "Memmax_MB": (number) 0
    "Maxsock": (number) 4011

As you can see the CORE2 is truncated and a new CORE1 continues printing after a new call to the webservice is made.. (there was time between it stopping output on screen and the next web call..)


Reply via email to