haproxy public development tree
Go to file
Willy Tarreau 89f6dedf48 BUG/MINOR: lua/vars: prevent get_var() from allocating a new name
Variable names are stored into a unified list that helps compare them
just based on a pointer instead of duplicating their name with every
variable. This is convenient for those declared in the configuration
but this started to cause issues with Lua when random names would be
created upon each access, eating lots of memory and CPU for lookups,
hence the work in 2.2 with commit 4e172c93f ("MEDIUM: lua: Add
`ifexist` parameter to `set_var`") to address this.

But there remains a corner case with get_var(), which also allocates
a new variables. After a bit of thinking and discussion, it never
makes sense to allocate a new variable name on get_var():
  - if the name exists, it will be returned ;
  - if it does not exist, then the only way for it to appear will
    be that some code calls set_var() on it
  - a call to get_var() after a careful set_var(ifexist) ruins the
    effort on set_var().

For this reason, this patch addresses this issue by making sure that
get_var() will never cause a variable to be allocated. This is done
by modifying vars_get_by_name() to always call register_name() with
alloc=0, since vars_get_by_name() is exclusively used by Lua and the
new CLI's "get/set var" which also benefit from this protection.

It probably makes sense to backport this as far as 2.2 after some
observation period and feedback from users.

For more context and discussions about the issues this was causing,
see https://www.mail-archive.com/haproxy@formilux.org/msg40451.html
and in issue #664.
2021-05-13 13:44:32 +02:00
.github Revert "CI: Build VTest with clang" 2021-05-12 21:28:08 +02:00
addons BUILD/MINOR: opentracing: fixed compilation with filter enabled 2021-05-12 09:45:16 +02:00
admin DOC: fix a few remainig cases of "Haproxy" and "HAproxy" in doc and comments 2021-05-09 06:50:46 +02:00
dev CLEANUP: dev/flags: remove useless test in the stdin number parser 2021-04-03 15:29:10 +02:00
doc MINOR: activity/cli: optionally support sorting by address on "show profiling" 2021-05-13 10:00:17 +02:00
examples EXAMPLES: add a trivial config for quick testing 2021-05-12 17:54:56 +02:00
include IMPORT: slz: do not produce the crc32_fast table when CRC is natively supported 2021-05-12 09:29:33 +02:00
reg-tests REGTESTS: stick-table: add src_conn_rate test 2021-05-12 15:30:03 +02:00
scripts REGTESTS: run-regtests: match both "HAProxy" and "HA-Proxy" in the version 2021-05-09 06:12:41 +02:00
src BUG/MINOR: lua/vars: prevent get_var() from allocating a new name 2021-05-13 13:44:32 +02:00
tests CLEANUP: lists/tree-wide: rename some list operations to avoid some confusion 2021-04-21 09:20:17 +02:00
.cirrus.yml CI: cirrus: install "pcre" package 2021-04-15 08:35:46 +02:00
.gitattributes MINOR: Configure the cpp userdiff driver for *.[ch] in .gitattributes 2021-02-22 18:17:57 +01:00
.gitignore ADDONS: make addons/ discoverable by git via .gitignore 2021-05-07 16:48:14 +02:00
.travis.yml Revert "CI: Build VTest with clang" 2021-05-12 21:28:08 +02:00
BRANCHES
CHANGELOG [RELEASE] Released version 2.4-dev19 2021-05-10 07:50:26 +02:00
CONTRIBUTING CLEANUP: contrib: remove the last references to the now dead contrib/ directory 2021-04-21 15:13:58 +02:00
INSTALL BUILD: makefile: add a few popular ARMv8 CPU targets 2021-05-12 14:23:22 +02:00
LICENSE
MAINTAINERS CONTRIB: move spoa_example out of the tree 2021-04-21 09:39:06 +02:00
Makefile BUILD: makefile: add a few popular ARMv8 CPU targets 2021-05-12 14:23:22 +02:00
README
ROADMAP
SUBVERS
VERDATE [RELEASE] Released version 2.4-dev19 2021-05-10 07:50:26 +02:00
VERSION [RELEASE] Released version 2.4-dev19 2021-05-10 07:50:26 +02:00

The HAProxy documentation has been split into a number of different files for
ease of use.

Please refer to the following files depending on what you're looking for :

  - INSTALL for instructions on how to build and install HAProxy
  - BRANCHES to understand the project's life cycle and what version to use
  - LICENSE for the project's license
  - CONTRIBUTING for the process to follow to submit contributions

The more detailed documentation is located into the doc/ directory :

  - doc/intro.txt for a quick introduction on HAProxy
  - doc/configuration.txt for the configuration's reference manual
  - doc/lua.txt for the Lua's reference manual
  - doc/SPOE.txt for how to use the SPOE engine
  - doc/network-namespaces.txt for how to use network namespaces under Linux
  - doc/management.txt for the management guide
  - doc/regression-testing.txt for how to use the regression testing suite
  - doc/peers.txt for the peers protocol reference
  - doc/coding-style.txt for how to adopt HAProxy's coding style
  - doc/internals for developer-specific documentation (not all up to date)