Hey guys,

After commit bf89ff3db8be1a8f87de305c144467bbc2503036
"MEDIUM: stream-int: make stream_int_update() aware of the lower layers"
I'm not able to use client sockets from tasks created with Lua (see
attached configuration and Lua script)

You will need LuaSocket library to run the test code, but I also get the
same issue without it (using raw core.tcp() and custom http library).

Before the commit cron works fine, connection and http layer (returns
404 since http.socket is a little bit stupid, but ignore that).

After the commit, http.socket reports 'Can't connect' (and 'connection
closed' afterwards). Debug log shows significant time spent in
'stream_int_chk_rcv_applet()'

Best regards,
-- 
Adis Nezirovic
Software Engineer
HAProxy Technologies - Powering your uptime!
375 Totten Pond Road, Suite 302 | Waltham, MA 02451, US
+1 (844) 222-4340 | https://www.haproxy.com
global
    log /dev/log local0 debug
    nbproc 1
    daemon
    lua-load cron.lua

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

frontend cron
    bind 127.0.0.1:9000
    http-request use-service lua.cron
local http = require 'socket.http'
local ltn12 = require 'ltn12'

local function main(applet)
end

local function cron()
    local headers = {
        host = 'www.haproxy.org'
    }
    local content = {}

    while true do
        core.Debug('CRON')
        local b, c, h = http.request {
            method='GET',
            headers=h,
            url = 'http://51.15.8.218',
            sink = ltn12.sink.table(content),
            redirect = false,
            create = core.tcp
        }
        core.Debug(tostring(c))  -- http.request doesn't use Host header
                                 -- so we expect 404 response here
        core.msleep(1000)
    end
end

core.register_service("cron", "http", main)
core.register_task(cron)

Reply via email to