Discussion:
BUG: Lua tasks can't use client sockets after bf89ff3d
Willy Tarreau
2018-11-29 08:03:34 UTC
Permalink
Hi Adis,
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)
Ah crap :-(

I tried to be careful, but was worried at the same time, seeing that
Lua directly manipulates the stream interface's update functions. But
I don't know how to test for this, so I only relied on the reg tests
at the moment.
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()'
OK thanks, I'll take a look at it once I've flushed my pending stuff on
H2+HTX :-(

Cheers,
Willy
PiBa-NL
2018-11-30 01:42:26 UTC
Permalink
Hi Frederic, Adis,
Post by Willy Tarreau
Hi Adis,
Post by Willy Tarreau
OK thanks, I'll take a look at it once I've flushed my pending stuff on
H2+HTX :-(
Great, I had my morning coffee and visited my optometrist, so here is
a fixed test script (correctly setting Host header).
P.S.
Lua usually suffers trying to do things in tasks, I don't think this is
the first time something gets broken. Can we make reg test with Lua
script (maybe strip out LuaSocket requirement)?
Yes. There already exist LUA reg tests in reg-tests/lua directory.
Fred.
Indeed some LUA tests already exists, but it didn't check to use a
socket from a task.

Attached a new test which does, and does indeed fail on versions since
the mentioned commit.
Should i make a patch out of it for inclusion in git? Or can you guys do
that once the fix is also ready.? i think it was the preferred to get
bugfix+regtest 'linked' then ?

Regards,
PiBa-NL (Pieter)
Willy Tarreau
2018-11-30 05:14:54 UTC
Permalink
Hi Pieter,
Attached a new test which does, and does indeed fail on versions since the
mentioned commit.
Thanks!
Should i make a patch out of it for inclusion in git? Or can you guys do
that once the fix is also ready.? i think it was the preferred to get
bugfix+regtest 'linked' then ?
I prefer to have the tests ASAP, as they are helpful to test bugs. In
my opinion, tests should not be limited to known bugs, since the only
purpose they provide in this case is to help with backports of fixes.
So please send a patch for inclusion, I'll take it.

Thanks!
Willy

Loading...