Hi Grant, It seems to be a bug. The action should allow yield.
Could you have a method for reproducing the bug ? Thierry On Tue, 15 May 2018 01:11:46 +0000 Grant Byers <[email protected]> wrote: > Hi all, > > Is it at all feasible to modify a TCP payload via a custom LUA action > in a stable manner? ie, something like this; > > > function enrich_query(txn) > --- Duplicate request. :set() will replace the request, if possible > local req = txn.req:dup() > > -- if error or client closes connection, quit > if req == nil then return end > > --- Add an identifier for haproxy and include client's IP address. > if txn.req:set("-Vha1.8," .. txn.f:src() .. " " .. req) == -1 then > txn.Error(txn, "Failed to enrich query") > end > end > > core.register_action('enrich_query', {'tcp-req'}, enrich_query) > > > Then called as an action in the frontend; > > # Don't enrich if query already contains client identification > acl has_client_version req.payload(0,0) -m sub -- -V --client > > # Enrich our query > tcp-request content lua.enrich_query if !has_client_version > WAIT_END > > > The reason I ask is that I randomly get yield errors, I assume during > the txn.req:set() ; > > Lua function 'enrich_query': yield not allowed. > > > I have experimented with different values of tune.lua.forced-yield with > little success. Sometimes this occurs very infrequently, other times, > very frequently. > > FYI - I have experimented with PROXY, but our backend application is > using a java API that doesn't have native PROXY support (although > there's been a patch pending for about 5 years). Have also experimented > with PROXY and Cloudflare's "mmproxy". That works well, but i've been > asked to use LUA to extend haproxy if possible. > > > Thanks, > Grant

