Willy, Here is the single line patch (sans comment).
Thanks for the quick response. - Camilo On Mon, Aug 3, 2015 at 9:51 AM, Willy Tarreau <w...@1wt.eu> wrote: > Hi Camilo, > > On Sun, Aug 02, 2015 at 07:07:28PM -0400, Camilo Lopez wrote: >> Dearest HAProxy people, >> >> I've been trying out 1.6 dev3 with lua support, and trying to start >> lua tasks seems to not be working. >> >> Using this configuration >> >> global >> lua-load /lua/lol.lua >> debug >> maxconn 4096 >> >> backend shard_b >> server db01 mysql_shard_b:3306 >> >> backend shard_a >> server db01 mysql_shard_a:3306 >> >> >> listen mysql-cluster >> bind 0.0.0.0:8001 >> mode tcp >> balance roundrobin >> use_backend shard_b >> >> >> And this lua function >> >> core.register_task(function() >> while true do >> core.Alert("LOLOLOLOLOL") >> end >> end) >> >> I'd always get a timeout error starting the registered function. >> >> The problem lies as far as I can tell in the fact that is possible for >> now_ms to not change (is this maybe a problem on my config/system?) > > That's expected since you can do many things in a single millisecond. > >> until the expiration check happens, in the resume function that >> actually kickstarts the lua task, making HAProxy think that expiration >> time for the task is up, if I understand correctly tasks are meant to >> never really timeout. > > If the timeout is not set it's indeed set to zero. > >> I'm attaching a tiny patch that fixes it for me, but seems rather >> naive. It exploits the fact that hlua_timeout_task is set to >> TICK_ETERNITY, which might or might not be an okay assumption to make >> moving forward. > > Your fix isn't naive, it's correct. Timeouts should be considered only > when they're set, as is done at many other places. I just think that you > should remove the comment justifying this because what you did is the > expected behaviour so the explanation becomes confusing as it makes the > reader think there's something special there. > > Thanks, > Willy >
luapatch.patch
Description: Binary data