Hello guys,

I've noticed that a Lua service timeouts in DATA phase, for outputs
equal or bigger than 8k (approx).

After the timeout (timeout client), it returns the full response.
(Termination state is cD--)

I've attached the minimal configuration and a Lua script to trigger the
problem. You might need to tweak the length of test string, I even have
different behavior depending on the Lua code:

-- variant a) loop with hardcoded bounds:
    for i = 1, 7492 do

-- variant b) using local variable
    local body_len = 7491
    for i = 1, body_len do

Makeflags:
make TARGET=linux2628 USE_GETADDRINFO=1 USE_ZLIB=1 USE_OPENSSL=1
USE_LUA=1 USE_PCRE=1 USE_PCRE_JIT=1


git bisect tells me the bug appears after the following commit:

commit 0194897e540cec67d7d1e9281648b70efe403f08
Author: Emeric Brun <[email protected]>
Date:   Thu Mar 30 15:37:25 2017 +0200

    MAJOR: task: task scheduler rework.


Best regards,
Adis
local function http_response(applet, code, data, content_type)
    applet:set_status(code)
    applet:add_header("Content-Length", string.len(data))
    applet:add_header("Content-Type", content_type)
    applet:start_response()
    applet:send(data)
end

local function main(applet)
    local c = core.concat()

    -- variant a) 
    for i = 1, 7492 do
    -- variant b)
    -- local body_len = 7491
    -- for i = 1, body_len do
        c:add("#")
    end

    http_response(applet, 200, c:dump(), "text/plain")
end

core.register_service("block", "http", main)
global
    log /dev/log local0 debug
    lua-load /etc/haproxy/lua/block.lua

defaults
    log global
    mode http
    option httplog
    timeout connect 5s
    timeout client 7s
    timeout server 10s

listen block
    bind 127.0.0.1:9001
    http-request use-service lua.block

Reply via email to