-
Notifications
You must be signed in to change notification settings - Fork 40
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
Maximum call stack size exceeded #586
Comments
Do you happen to know the steps to repro? Our internal tests don't seem to hit this, it's going to be hard to figure out what is wrong without some high level understanding of what manipulation causes it... 🤔 Maybe you could copy a test like this one, to replicate? ember-template-recast/src/parse-result.test.ts Lines 16 to 26 in ec7c070
|
No idea yet. It might even be a complete red herring as only when I shake the yarn.lock I get the problematic behaviour. I will try to get a failing test for you. |
I could trace it to this recursive print() function. When I try to {
type: 'ConcatStatement',
parts: [
{
type: 'TextNode',
chars: '\n' +
' bazDoo\n' +
' gap-4 grid grid-cols-2\n' +
' lg:grid-cols-5 md:grid-cols-3 sm:grid-cols-3 xl:grid-cols-6\n' +
' ',
loc: [Object]
},
{
type: 'MustacheStatement',
path: [Object],
params: [Array],
hash: [Object],
escaped: true,
loc: [Object],
strip: [Object]
},
{ type: 'TextNode', chars: '\n ', loc: [Object] },
{
type: 'MustacheStatement',
path: [Object],
params: [Array],
hash: [Object],
escaped: true,
loc: [Object],
strip: [Object]
},
{ type: 'TextNode', chars: '\n ', loc: [Object] }
],
loc: {
source: null,
start: { line: 3, column: 10 },
end: { line: 13, column: 5 }
}
} Which seems reasonable to me. But I don't understand why it's recursing infinitely nor what's the logic of that function in the first place. |
- Test proving that when you reuse parts from previous concat statement in new concat statement you will get "Maximum callstack size exceeded"
- Test proving that when you reuse parts from previous concat statement in new concat statement you will get "Maximum callstack size exceeded"
…verflow - Seems like anything that comes out of `parse()` apart from the whole object will trigger the stack overflow.
Fixes ember-template-lint#586 Previously, calling print on node that came from our parse(), but was not the top-level node, would cause infinite recursion. (It would have NodeInfo, but not a registered parse result). This fixes the infinite loop, by just storing a reference to the top-level parse result in the node info, and using that. Importantly, this successfully preserves formatting for any sub-nodes we did parse ourselves, or any user-created nodes that require custom printing.
- Test proving that when you reuse parts from previous concat statement in new concat statement you will get "Maximum callstack size exceeded"
- Seems like anything that comes out of `parse()` apart from the whole object will trigger the stack overflow.
- Test proving that when you reuse parts from previous concat statement in new concat statement you will get "Maximum callstack size exceeded"
…verflow - Seems like anything that comes out of `parse()` apart from the whole object will trigger the stack overflow.
Fixes ember-template-lint#586 Previously, calling print on node that came from our parse(), but was not the top-level node, would cause infinite recursion. (It would have NodeInfo, but not a registered parse result). This fixes the infinite loop, by just storing a reference to the top-level parse result in the node info, and using that. Importantly, this successfully preserves formatting for any sub-nodes we did parse ourselves, or any user-created nodes that require custom printing.
Sounds like this one was resolved with #671 |
Somewhere between
v5.0.1
andv5.0.3
we got an issue that manifests as follows (log taken fromember-template-lint-plugin-tailwindcss
):The text was updated successfully, but these errors were encountered: