]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MEDIUM: lua: outgoing connection was broken since 1.6-dev2
authorWilly Tarreau <w@1wt.eu>
Mon, 24 Aug 2015 13:42:28 +0000 (15:42 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 25 Aug 2015 14:58:00 +0000 (16:58 +0200)
commitbdc97a8795c52af94683db25a4984578e26f4857
tree3e0759a01269949d164c8046816d4eb0452fef42
parentba56d9ceec87192cad11737f9ee140dff26b868d
BUG/MEDIUM: lua: outgoing connection was broken since 1.6-dev2

Tsvetan Tsvetanov reported that the following Lua code fails in
dev2 and dev3 :

function hello(txn)
    local request_msg = txn.req:dup()
    local tsm_sock = core.tcp()
    tsm_sock:connect("127.0.0.1", 7777)
    local res = tsm_sock:send(request_msg)
    local response = tsm_sock:receive('*l')
    txn.res:send(response)
    txn:close()
end

Thierry diagnosed that it was caused by commit 563cc37 ("MAJOR: stream:
use a regular ->update for all stream interfaces"). It broke lua's
ability to establish outgoing connections.

The reason is that the applet used to be notified about established
connections just after the stream analyser loop, and that's not the
case anymore. In peers, this issue didn't happen because peers use
a handshake so after sending data, the response is received and wakes
the applet up again. Here we have to indicate that we want to send or
receive data, this will cause the notification to happen as soon as
the connection is ready. This is similar to pretending that we're
working on a full buffer after all. In theory subscribing for reads
is not needed, but it's added here for completeness.

Reported-By: Tsvetan Tsvetanov <cpi.cecko@gmail.com>
src/hlua.c