When using core.msleep in lua, the %Tw metric is a negative value.

For example with the following config:
haproxy.cfg:
        global
            lua-load /tmp/haproxy.lua

        frontend f1
            mode http
            bind :8000
            default_backend b1
            log 127.0.0.1:1234 daemon
            log-format Ta=%Ta\ Tc=%Tc\ Td=%Td\ Th=%Th\ Ti=%Ti\ Tq=%Tq\
TR=%TR\ Tr=%Tr\ Tt=%Tt\ Tw=%Tw

        backend b1
            mode http
            http-request use-service lua.foo

haproxy.lua:
        core.register_service("foo", "http", function(applet)
            core.msleep(100)
            applet:set_status(200)
            applet:start_response()
        end)

The log contains:
    Ta=104 Tc=0 Td=0 Th=0 Ti=0 Tq=104 TR=104 Tr=104 Tt=104 Tw=-104

^ TR also looks wrong, as it did not take 104ms to receive the full request.

This is built from the commit before current master: d8fd2af

-Patrick

Reply via email to