]> git.kaiwu.me - haproxy.git/commit
BUG/MEDIUM: regex: initialize the match array earlier during boot
authorWilly Tarreau <w@1wt.eu>
Sun, 7 Jun 2026 05:03:06 +0000 (07:03 +0200)
committerWilly Tarreau <w@1wt.eu>
Sun, 7 Jun 2026 05:46:32 +0000 (07:46 +0200)
commitac776e3819f9fa54e2a005469e5a423a3d179543
tree090e67c83fe4b165a131c7371f57567e84abb565
parent1e00743520ddb82546ffb5b1ddf690b824e44c51
BUG/MEDIUM: regex: initialize the match array earlier during boot

As reported by @zhanhb in github issue #3410, since 3.3 with commit
fda6dc959 ("MINOR: regex: use a thread-local match pointer for pcre2"),
the local_pcre2_match array is initialized too late for use by Lua. If
a lua-load makes use of regex, it may segfault (actually using PCRE2
is fine but PCRE2_JIT will crash):

Let's change the init sequence so that the first thread's context is
initialized early at boot and other threads are initialized when they
are created. For lua-load-per-thread, all extra threads will run on
the first thread's temporary storage during init but that's not a
problem since the sole purpose is to avoid concurrent accesses.

Thanks to @zhanbb for the detailed report and quick tests. This needs
to be backported to 3.3.
src/regex.c