Browse Source

Fix random mariabackup crashes with latest pcre2.

Seen on Windows using newest pcre2-10.45. Tests that use regular expression
e.g., mariabackup.partial, fail very often.

To fix, serialize regexec calls, which are documented as non-thread-safe
in https://www.pcre.org/current/doc/html/pcre2posix.html.
pull/3951/head
Vladislav Vaintroub 7 months ago
committed by Sergei Golubchik
parent
commit
10b2187a94
  1. 9
      extra/mariabackup/xtrabackup.cc

9
extra/mariabackup/xtrabackup.cc

@ -2544,6 +2544,15 @@ my_bool regex_list_check_match(
const regex_list_t& list,
const char* name)
{
if (list.empty()) return (FALSE);
/*
regexec/pcre2_regexec is not threadsafe, also documented.
Serialize access from multiple threads to compiled regexes.
*/
static std::mutex regex_match_mutex;
std::lock_guard<std::mutex> lock(regex_match_mutex);
regmatch_t tables_regmatch[1];
for (regex_list_t::const_iterator i = list.begin(), end = list.end();
i != end; ++i) {

Loading…
Cancel
Save