-
-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Version 0.13.0 throws an Error::BacktrackLimitExceeded #138
Comments
hmm, I tried to reproduce this with the cargo run --example toy -- run '\b\$?t\('\''(. ?)'\''\)' 'content...'
|
Hi folks, I'm also encountering this issue with complex, user-defined regex patterns (bad practices, horrible pattern), such as:
The error RuntimeError(BacktrackLimitExceeded) frequently occurs when using fancy_regex==0.13.0, compared to 0.12.0. I’m aware that the backtracking limit can be increased here: https://docs.rs/fancy-regex/latest/fancy_regex/struct.RegexBuilder.html#method.backtrack_limit, but the question is: why does this error happen much more often in this version than in the previous one? It seems like the internals are consuming significantly more resources or states. I suspect this is related to the switch from the
|
Thanks for reporting with an additional example. I unfortunately have very little free time these days to investigate. I wonder if the different |
I had a look at the first example by @jcold. The difference seems to be caused by the
So 0.12.0 delegates the entire expression. Whereas 0.13.0 doesn't delegate the WordBoundary:
@ruihe774 Thoughts about this? I would probably go back to delegating word boundary matches again. |
Let me look into this. |
I'd suggest to increase the backtrack limit. If we delegate the word boundary assertions to The total times of backtracking does not change. It is just that in previous implementation we delegated some backtracking to the underlying PikeVM of There is no performance regression or memory usage regression. |
Thats it, perfect, thanks for the explanation . Maybe warn on changelog to expect a need on increasing this limit that can be hitten more easily (as it counts more backtracks that were done under the hoods before) after upgrading to 0.13.0 from <0.13.0. It would reduce future noise on issues about this subject. |
The following code snippet works fine in v0.12.0, but in v0.13.0 it throws an Error::BacktrackLimitExceeded. The regex crates have been checked and they are fine. Any assistance would be appreciated.
error message:
Error executing regex: Max limit for backtracking count exceeded
The text was updated successfully, but these errors were encountered: