]> git.kaiwu.me - haproxy.git/commit
MINOR: lua: handle proxy refcount
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Wed, 18 Feb 2026 08:55:13 +0000 (09:55 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Mon, 2 Mar 2026 13:08:30 +0000 (14:08 +0100)
commitad1e00b2ac5d3d4a6cc1cb6834be4277185f6c2d
tree98a4fc0b021a9da7b5a955188baee16492854a3d
parentf521c2ce2d97b752c14680846e23ffb9f30211a3
MINOR: lua: handle proxy refcount

Implement proxy refcount for Lua proxy class. This is similar to the
server class.

In summary, proxy_take() is used to increment refcount when a Lua proxy
is instantiated. proxy_drop() is called via Lua garbage collector. To
ensure a deleted backend is released asap, hlua_check_proxy() now
returns NULL if PR_FL_DELETED is set.

This approach is directly dependable on Lua GC execution. As such, it
probably suffers from the same limitations as the ones already described
in the previous commit. With the current patch, "del backend" is not
directly impacted though. However, the final proxy deinit may happen
after a long period of time, which could cause memory pressure increase.

One final observations regarding deinit : it is necessary to delay a
BUG_ON() which checks that defaults proxies list is empty. Now this must
be executed after Lua deinit (called via post_deinit_list). This should
guarantee that all proxies and their defaults refcount are null.
src/haproxy.c
src/hlua_fcn.c