It seems that the memleak doesn't appear when if remove the line which sets the "priv" context do nil.
So, when I comment this line: txn:set_priv(txnPrvState); The memleak disappear. Now if you want, you can apply this workaroud. I try to understand the memleak. Thierry On Wed, 26 Apr 2017 12:11:16 +0200 Thierry Fournier <[email protected]> wrote: > Hi, > > Thanks for the bug report. I can reproduce the bug. > I will look for a fix. > > Thierry > > > > On 26 Apr 2017, at 05:14, Philip Seidel <[email protected]> wrote: > > > > Possible Lua Memory Leak? > > > > We are running HAProxy version 1.7.2 (also tested 1.7.5) and are loading a > > Lua file which makes use of 2 actions. The first action is called on > > http-request and the second on http-response. In the simple test case we > > put together the request action stores some data in a table and calls > > txn:set_priv to save the state for the transaction. The response action > > calls txn:get_priv in order to access the state that was set in the request > > action. All variables are set to nil once they are no longer needed but it > > seems that no matter what kind of load HAProxy is receiving we leak a > > little bit of memory with each request. Eventually, response times begin > > to increase to the point where health checks to HAProxy begin to fail and > > the server is unresponsive. We can take the instance out of rotation and > > memory still doesn't get reclaimed despite all connections to the frontend > > and backend being closed. We do see garbage collections happening but it > > never cleans up enough to stabi lize the instance. The leak is easily reproducible using a local test instance and JMeter. The test uses 10 connections with keep-alive at around 1500 r/s. It takes only a few minutes to consume over 1.5G of memory. Any ideas as to what might be going on here? Is there something wrong with how we are attempting to integrate these LUA actions? I am happy to provide additional information if anyone is willing to assist with this. I have posted the configuration and other files on pastebin. > > > > Configuration - https://pastebin.com/SBtAEZ9R > > Lua - https://pastebin.com/64Anbxm4 > > > >

