Hello, everyone.

I am encountering a problem with LUA in haproxy, I also reported it here
https://github.com/sflow/haproxy/issues/2 but the problem is lieke this:

When using a response action, this function - sleeps for 10 seconds, no
matter what param i pass to it. Also it seems that the wait time always
equals timeout connect. The sample config is:

    global
    daemon
    log /dev/log local6
    lua-load /etc/haproxy/delay.lua

    defaults
    mode http
    timeout connect 10000ms

    frontend fe
    bind *:80
    mode http
    default_backend b_http_hosts

    backend b_http_hosts
    mode http
    http-response lua.delay_response
    server s_web1 server:80 check

and the LUA code:

    function delay_response(txn)
    core.msleep(1)
    end

    core.register_action("delay_response", {"tcp-res", "http-res" },
    delay_response);

Note that if core.msleep() is commented out - everything works as expected.

I tested version 1.6 (it hangs 30 seconds there), 1.7 - matches timeout
connect, and 1.8 - same as 1.7.

Any idea how to overcome this problem? All i need is to delay the
responses based on information from backend header.

Reegards!

Reply via email to