Open ahankinson opened 1 month ago
Can you please see if you can reproduce this with v1.1.7?
elm-review --template SiriusStarr/elm-review-no-unsorted/example#1.1.7 --rules NoUnsortedRecords
(And run the 1.1.8 example as well just to compare like to like.)
It's a bit tricky to track down.
I can get 1.1.8 to run if I remove the "generated code" folder in .elm-stuff and re-run it on the project. If I try to re-run, It runs out of memory. This is with the '--template' just running this rule.
I also experience the same thing with 1.1.7 changing the template version.
However, if I install / uninstall the modules with elm-json, I can get 1.1.7 to run pretty consistently, but 1.1.8 crashes.
It's kinda like the #1.1.7
specifier doesn't work and that it's always running 1.1.8 with the --template
argument?
Anyway, I think I can say that, when running the specific version in my project, 1.1.7 works fine, and 1.1.8 crashes.
I don't know that this is really "fixable" until elm-review gets type information. NoUnsortedRecords
basically has to store info on every single top level declaration in your entire project (and all its dependencies) to try to make sense of the types of record fields. That could obviously be turned off, at the cost of records just becoming ambiguous if they have the same field names but different types.
As a workaround, you should be able to just increase the heap allocation limit of node. Can you try
NODE_OPTIONS=--max_old_space_size=4096 npx elm-review --template SiriusStarr/elm-review-no-unsorted/example#1.1.8 --rules NoUnsortedRecords
or the like (I think the default is only like 1.4 GB or something) and see if that works fine for you? I don't think this is a bug in the rule so much as just running up into the default limits of the node runtime.
When enabling NoUnsortedRecords in my elm review rules, the process crashes with an out-of-memory error. Disabling this rule allows elm-review to work.
Macbook Pro, M2 Pro, 32GB, macOS Sequoia 15.0 (although it also crashed in previous versions too).
Statistics of project being reviewed:
Stack Trace
``` <--- Last few GCs ---> [73294:0x120008000] 14114 ms: Mark-Compact 4062.9 (4136.3) -> 4062.1 (4135.6) MB, pooled: 1 MB, 544.75 / 0.00 ms (average mu = 0.647, current mu = 0.091) allocation failure; scavenge might not succeed [73294:0x120008000] 14146 ms: Scavenge (interleaved) 4070.0 (4135.6) -> 4070.0 (4159.6) MB, pooled: 0 MB, 19.46 / 0.00 ms (average mu = 0.647, current mu = 0.091) allocation failure; <--- JS stacktrace ---> FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory ----- Native stack trace ----- 1: 0x10255b730 node::OOMErrorHandler(char const*, v8::OOMDetails const&) [/opt/homebrew/Cellar/node/22.8.0/bin/node] 2: 0x102702eb4 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [/opt/homebrew/Cellar/node/22.8.0/bin/node] 3: 0x102702e68 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [/opt/homebrew/Cellar/node/22.8.0/bin/node] 4: 0x1028abdc0 v8::internal::Heap::CallGCPrologueCallbacks(v8::GCType, v8::GCCallbackFlags, v8::internal::GCTracer::Scope::ScopeId) [/opt/homebrew/Cellar/node/22.8.0/bin/node] 5: 0x1028aac3c v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/opt/homebrew/Cellar/node/22.8.0/bin/node] 6: 0x1028a1104 v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/opt/homebrew/Cellar/node/22.8.0/bin/node] 7: 0x1028a1870 v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/opt/homebrew/Cellar/node/22.8.0/bin/node] 8: 0x102878428 v8::internal::FactoryBase