The GitHub Actions job "End to End" on 
grails-core.git/fix/gsp-page-scope-variable-scan-8.0.x has failed.
Run started by GitHub user codeconsole (triggered by codeconsole).

Head commit for run:
cc92b915d21369b717ee82c96ebcf943cd488f6f / Scott Murphy Heiberg 
<[email protected]>
Find the names a page introduces in one pass, not a regular expression

A page that compiled under 8.0.0-M6 stopped the build under 8.0.0-RC1 with a
StackOverflowError whose trace was one block of java.util.regex frames
repeating. The pattern that collects var and status attributes,

  <\w+:(?:[^>"']|"[^"]*"|'[^']*')*?\b(?:var|status)\s*=\s*["']...

pairs the quotes of an attribute without knowing what a ${...} expression is.
This line, ordinary GSP,

  <meta property="og:title" content="${t ?: 'Untitled'.replaceAll('"','\'')}" />

is scanned after the layout preprocessor has turned the meta into a namespaced
captureMeta tag. The " inside '"' closes the attribute as far as the pattern can
tell, the page's later quotes pair up across tags and swallow the > that should
end the attempt, and the lazy loop recurses once per character through the rest
of the page until the thread runs out of stack. With the JIT warm the frames are
small enough that a moderate page survives, which made it look intermittent: it
failed on a Linux x64 CI runner with its 1 MB default thread stack and compiled
on a developer machine.

PageScopeVariableScanner reads the same thing in one forward pass: it finds a
namespaced tag, steps over each ${...} expression as a unit — counting braces 
and
stepping over Groovy string literals, so a quote or a brace inside one ends
nothing — and records a var or status whose value is a quoted identifier. The
work is linear in the page and the call stack stays shallow whatever the page
contains. Well-formed tags give the same names as before, so the static
compilation this feeds is unchanged.

GspCompileStaticConfigSpec compiles a page shaped like the one that failed on a
256 KB thread; against the regular expression it fails with the same
StackOverflowError, and with the scan it compiles and still finds the name
introduced at the very end of the page.

Report URL: https://github.com/apache/grails-core/actions/runs/35793273082

With regards,
GitHub Actions via GitBox

Reply via email to