Closed weaversam8 closed 5 years ago
Could you share some more information?
I believe, this could help speed up debugging. Would it work if you run those watch tasks in different terminals? (I know, not as comfortable … but I usually see GC-errors happening with SASS and want to exclude that CSS-watch is the actual offender here).
Hey @Ryuno-Ki!
Node Version: v10.14.2 NPM Version: 6.2.0 Operating System: Windows 10 x64 Pro
I actually ran the second attempt (the second log I pasted in the initial issue) in a separate terminal after I had terminated all the watch tasks. I was literally just trying to run html-build
as the only task that time, no watch tasks.
Diving into the code again, I think I found what it was-
I created a layout called app.liquid
and then in the front-matter put the following:
---
layout: app
---
This created an infinite loop. Glad I figured it out. Might be nice to try and catch this sort of thing with an exception in the future.
I'd be happy to submit a PR if you can suggest where in the code I'd need to go to make the change :)
@weaversam8 Glad that you figured out the root issue :-) I'd assume that something like a stack depth could be handy … like „recursing max N steps deep”.
@zachleat Your project! You know best where too look at.
I am getting the same error and did not want to start a new issue so apologies if I posted in the wrong place. Here's what I am seeing via the terminal;
eleventy
<--- Last few GCs --->
[92851:0x10268f000] 74831 ms: Mark-sweep 1230.9 (1255.5) -> 1230.9 (1254.5) MB, 819.6 / 0.0 ms (average mu = 0.641, current mu = 0.000) last resort GC in old space requested
[92851:0x10268f000] 75654 ms: Mark-sweep 1230.9 (1254.5) -> 1230.9 (1254.5) MB, 822.9 / 0.0 ms (average mu = 0.467, current mu = 0.000) last resort GC in old space requested
<--- JS stacktrace --->
==== JS stack trace =========================================
0: ExitFrame [pc: 0x19df9595be3d]
Security context: 0x2f790af1e6e9 <JSObject>
1: getTemplateLayoutMap [0x2f7958a38531] [/usr/local/lib/node_modules/@11ty/eleventy/src/TemplateLayout.js:~54] [pc=0x19df95b87d16](this=0x2f790e1b1599 <TemplateContent map = 0x2f790af97441>)
2: /* anonymous */ [0x2f7903d022f1](this=0x2f79fa79ad81 <JSGlobal Object>,0x2f793242eb71 <Object map = 0x2f790af9ae59>)
3: StubFrame [pc: 0x19df959419b1]
...
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
1: 0x10003c597 node::Abort() [/usr/local/bin/node]
2: 0x10003c7a1 node::OnFatalError(char const*, char const*) [/usr/local/bin/node]
3: 0x1001ad575 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/usr/local/bin/node]
4: 0x100579242 v8::internal::Heap::FatalProcessOutOfMemory(char const*) [/usr/local/bin/node]
5: 0x100582744 v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [/usr/local/bin/node]
6: 0x100551a46 v8::internal::Factory::NewFixedArrayWithFiller(v8::internal::Heap::RootListIndex, int, v8::internal::Object*, v8::internal::PretenureFlag) [/usr/local/bin/node]
7: 0x1004f8e6e v8::internal::(anonymous namespace)::ElementsAccessorBase<v8::internal::(anonymous namespace)::FastPackedObjectElementsAccessor, v8::internal::(anonymous namespace)::ElementsKindTraits<(v8::internal::ElementsKind)2> >::GrowCapacity(v8::internal::Handle<v8::internal::JSObject>, unsigned int) [/usr/local/bin/node]
8: 0x100793fef v8::internal::Runtime_GrowArrayElements(int, v8::internal::Object**, v8::internal::Isolate*) [/usr/local/bin/node]
9: 0x19df9595be3d
[1] 92851 abort eleventy
I had been modifying the Eleventy-Netlfy-Boilerplate here but ran into some issues with templating again. So as of right now, I cannot deploy for whatever reason, to Netlify.
I was last successful about a week and a half ago, so I don't know what had changed since then, I know I did an OS update on my Mac to the latest Mojave version, but that was pretty much it. Any help would be greatly appreciated. Thanks.
@colabottles I'm no expert, but the JavaScript heap out of memory
error to me sounds like an infinite recursion issue (like I had.) Have you looked for any loops in your templates (either of the same type as mine or of a different type?)
Investigating the limited stack trace, if we look at the getTemplateLayoutMap()
method in TemplateLayout.js
, and we work off the Runtime_GrowArrayElements(...)
lead in the stack trace, I'm guessing an array has grown to a size that is too large for the heap. Line 61 and Line 70 both include calls to the .push(...)
method on an instance of Array
. I am not exactly sure what the getTemplateLayoutMap()
method is supposed to do, but it looks like it's processing the front matter of the page to try and get the template... that makes me suspicious that it's some sort of infinite loop in your template structure...
Again, I'm no expert in the internals of V8 so I don't really know how accurate this is, but maybe this is a lead to follow...
@weaversam8 I will take a look through, That had crossed my mind when I initially read your issue. I didn't see anything glaring on my first pass through, but now that I have some time, I'm going to go back through and go through with a fine tooth comb. Thanks for your reply!
@weaversam8 All files were fine, no loops in any template that I could see, but I'm no expert on this so I could be overlooking something someone with more experience would be able to spot quickly. I may try to back what I have up for code and then start over again from scratch. Not sure. I'm giving another few days before I do that. I'm also trying to find someone that would be willing to guide me through this and some templating questions I had about Eleventy.
@colabottles probably makes sense to try and make a minimum replication case you can publish... starting from scratch (or walking back to the last working state) should help with that.
If you have any questions about Eleventy (I've only worked with it a bit) feel free to reach out. You can get in touch with me via my Keybase!
Thanks for the issue @weaversam8. Do you care if I switch it over to a Enhancement Request for loop detection in Eleventy layouts? I think this would be a great addition. Sometimes they are hard to spot, I’d love to have better messaging around this
@zachleat No, I don't mind! That sounds like a great plan!
This repository is now using lodash style issue management for enhancements. This means enhancement issues will now be closed instead of leaving them open.
View the enhancement backlog here. Don’t forget to upvote the top comment with 👍!
Thanks to @AleksandrHovhannisyan this shipped with 2.0.0-canary.10!
Hey folks, sorry for the lack of a more descriptive issue name, but it isn't immediately apparent to me what's happening here.
I have my project set up to watch the various source files as I edit them (JS, SCSS, and HTML with Eleventy) and while editing, I noticed oddly that Eleventy seemed to crash with a lot of error messages that appeared low level. I believe it happened when I opened up a split terminal and installed another NPM package, but it could've just been a coincidence.
The relevant scripts from my
package.json
:The initial error log that occurred, in the output:
As you can see, this is quite hefty. I included a successful run of Eleventy from the log right before the error hit... it seemed to come out of the blue. I notice a lot of references to memory issues, but my laptop seems to have enough memory currently free to run JS VM.
The kicker is that now I can't compile anything from Eleventy anymore. I tried to run it again in a new command window with debug flags on and the following output resulted.
Also, worth noting that the above retry attempt hung for several minutes. I ran it with debug flags, saw it hang (right after
TemplatePassthrough copy finished
), started writing this issue, and then looked back and realized it had crashed.I'm probably going to restart my computer next but figured I'd capture this here now. Any ideas as to what could've caused this? I know it might not be related to the project but I wanted to document it in case it is.