Skip to content

Skip whole lines in chunk load exception patterns - #198

Open
pavog wants to merge 1 commit into
masterfrom
chunk-load-exception-pattern-backtracking
Open

pavog wants to merge 1 commit into
masterfrom
chunk-load-exception-pattern-backtracking

Conversation

@pavog

@pavog pavog commented Nov 13, 2026

Copy link
Copy Markdown
Member

ChunkLoadExceptionProblem searched the stack trace below "Encountered an unexpected exception" with (\n.*)*at.*.
The nested quantifiers backtrack per character, so on entries of about 1 MB the patterns hit the backtrack or JIT stack limit and the problem was silently not detected.

This PR skips whole lines possessively with (?:.*+\n)*?, so there is one backtracking point per line instead of per character.
The cause line is matched from its start: a stack trace line (\h*at followed by the package) or the exception chain before "Exception generating new chunk".
Without that, .*at.* still backtracked within every line, which failed without PCRE JIT.

The fragments are constants with examples, because they are used in three patterns.

Changes

  • add UNEXPECTED_EXCEPTION and STACK_TRACE_PACKAGE to ChunkLoadExceptionProblem
  • rewrite the three stack trace patterns with them
  • remove ChunkLoadExceptionProblem from KNOWN_UNSAFE_PATTERNS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant