[MDEV-8637] sysvar to control pcre match limit Created: 2015-08-17 Updated: 2020-08-25 Resolved: 2017-10-06 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | OTHER |
| Fix Version/s: | N/A |
| Type: | Task | Priority: | Major |
| Reporter: | Geoff Montee (Inactive) | Assignee: | Alexander Barkov |
| Resolution: | Won't Fix | Votes: | 1 |
| Labels: | upstream-not-affected | ||
| Description |
|
Under some conditions, the regexp function will raise a warning about some internal error:
It might be related to string length. Changing the length of the string makes the message go away:
|
| Comments |
| Comment by Sergei Golubchik [ 2015-08-17 ] | |||||||||||||||
|
Just FYI:
and it means
| |||||||||||||||
| Comment by Geoff Montee (Inactive) [ 2015-10-12 ] | |||||||||||||||
|
Thanks for the response! It looks like the server sets match_limit to 10 million at compile time: And it gets set here: https://github.com/MariaDB/server/blob/0d54cb12eb77c4c8c90e9833ec3df47c70c0ade7/pcre/pcrecpp.cc#L517 Do you think this should stay as-is? Maybe we could implement a run-time setting that allows PCRE's match_limit to be set higher for users who want to use really complicated regular expressions? | |||||||||||||||
| Comment by Alexander Barkov [ 2015-10-12 ] | |||||||||||||||
|
MySQL-5.7.8 is not affected. | |||||||||||||||
| Comment by Alexander Barkov [ 2015-10-12 ] | |||||||||||||||
|
A workaround would be to rewrite the regular expression in a little bit more efficient way,
It seems to be handled by pcre without problems this way. | |||||||||||||||
| Comment by Geoff Montee (Inactive) [ 2015-10-12 ] | |||||||||||||||
|
It looks like MySQL 5.7 still uses Henry Spencer's implementation of regular expressions, rather than PCRE, if the manual is correct, so it probably doesn't call pcre_exec(). | |||||||||||||||
| Comment by Alexander Barkov [ 2015-10-12 ] | |||||||||||||||
|
Geoff, right, I think MySQL still uses the old library.
| |||||||||||||||
| Comment by Geoff Montee (Inactive) [ 2015-10-12 ] | |||||||||||||||
|
Ah, I see. A session variable sounds like a good fix to me. Thanks! | |||||||||||||||
| Comment by Claudio Nanni [ 2015-10-13 ] | |||||||||||||||
|
Hi, Controlling the variable from MariaDB sounds good. | |||||||||||||||
| Comment by Alexander Barkov [ 2017-10-06 ] | |||||||||||||||
|
Sergei thinks we should not add this variable. With a too much complex regular expression, performance becomes too bad anyway. |