question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"Allocation failed - JavaScript heap out of memory" when using incorrect CSS value with a comment

See original GitHub issue

OS:

$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 18.04.2 LTS
Release:	18.04
Codename:	bionic

Less.js version:

$ lessc --version
lessc 3.10.3 (Less Compiler) [JavaScript]

main.less:

.test {
    color: #fffff /* comment */;
}

(note that the color property value is incorrect)

Expected result (you can get this if you remove the comment):

$ lessc main.less main.css
ParseError: Unrecognised input in /home/flash/main.less on line 2, column 18:
1 .test {
2     color: #fffff;
3 }

Actual result:

$ lessc main.less main.css

<--- Last few GCs --->

[22053:0x2c329a0]     7929 ms: Mark-sweep 1268.5 (1442.5) -> 1259.4 (1443.0) MB, 255.8 / 0.0 ms  (average mu = 0.140, current mu = 0.043) allocation failure scavenge might not succeed
[22053:0x2c329a0]     8195 ms: Mark-sweep 1271.2 (1443.0) -> 1263.0 (1445.0) MB, 255.5 / 0.0 ms  (average mu = 0.091, current mu = 0.039) allocation failure scavenge might not succeed


<--- JS stacktrace --->

==== JS stack trace =========================================

Security context: 0x0f92c181e6e1 <JSObject>
    0: builtin exit frame: defineProperty(this=0x0f92c1804631 <JSFunction Object (sfi = 0x22999e78e301)>,0x25b50f3f19f9 <Object map = 0x19dee123a331>,0x2491b7d79d19 <String[15]: currentFileInfo>,0x25b50f3f1959 <Comment map = 0xb9e083900c1>,0x0f92c1804631 <JSFunction Object (sfi = 0x22999e78e301)>)

    1: expression [0x1e31b86c9279] [/home/flash/.nvm/versions/node/v10.15.2/lib/node_modules/less/...

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
 1: 0x8dc1c0 node::Abort() [node]
 2: 0x8dc20c  [node]
 3: 0xad60ae v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [node]
 4: 0xad62e4 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [node]
 5: 0xec3972  [node]
 6: 0xec3a78 v8::internal::Heap::CheckIneffectiveMarkCompact(unsigned long, double) [node]
 7: 0xecfb52 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [node]
 8: 0xed0484 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node]
 9: 0xed30f1 v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [node]
10: 0xe9c1e6 v8::internal::Factory::AllocateRawArray(int, v8::internal::PretenureFlag) [node]
11: 0xe9ca6a v8::internal::Factory::NewFixedArrayWithFiller(v8::internal::Heap::RootListIndex, int, v8::internal::Object*, v8::internal::PretenureFlag) [node]
12: 0xe9cb10 v8::internal::Handle<v8::internal::FixedArray> v8::internal::Factory::NewFixedArrayWithMap<v8::internal::FixedArray>(v8::internal::Heap::RootListIndex, int, v8::internal::PretenureFlag) [node]
13: 0xfdc029 v8::internal::HashTable<v8::internal::NameDictionary, v8::internal::NameDictionaryShape>::New(v8::internal::Isolate*, int, v8::internal::PretenureFlag, v8::internal::MinimumCapacity) [node]
14: 0xfdc089 v8::internal::BaseNameDictionary<v8::internal::NameDictionary, v8::internal::NameDictionaryShape>::New(v8::internal::Isolate*, int, v8::internal::PretenureFlag, v8::internal::MinimumCapacity) [node]
15: 0x10014ee v8::internal::JSObject::MigrateToMap(v8::internal::Handle<v8::internal::JSObject>, v8::internal::Handle<v8::internal::Map>, int) [node]
16: 0xfb4c42 v8::internal::LookupIterator::TransitionToAccessorProperty(v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>, v8::internal::PropertyAttributes) [node]
17: 0xfca59b v8::internal::JSObject::DefineAccessor(v8::internal::LookupIterator*, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>, v8::internal::PropertyAttributes) [node]
18: 0xff1520 v8::internal::JSReceiver::ValidateAndApplyPropertyDescriptor(v8::internal::Isolate*, v8::internal::LookupIterator*, bool, v8::internal::PropertyDescriptor*, v8::internal::PropertyDescriptor*, v8::internal::ShouldThrow, v8::internal::Handle<v8::internal::Name>) [node]
19: 0xff8c16 v8::internal::JSReceiver::OrdinaryDefineOwnProperty(v8::internal::LookupIterator*, v8::internal::PropertyDescriptor*, v8::internal::ShouldThrow) [node]
20: 0xff90b8 v8::internal::JSReceiver::OrdinaryDefineOwnProperty(v8::internal::Isolate*, v8::internal::Handle<v8::internal::JSObject>, v8::internal::Handle<v8::internal::Object>, v8::internal::PropertyDescriptor*, v8::internal::ShouldThrow) [node]
21: 0x1008722 v8::internal::JSReceiver::DefineOwnProperty(v8::internal::Isolate*, v8::internal::Handle<v8::internal::JSReceiver>, v8::internal::Handle<v8::internal::Object>, v8::internal::PropertyDescriptor*, v8::internal::ShouldThrow) [node]
22: 0x1008cfd v8::internal::JSReceiver::DefineProperty(v8::internal::Isolate*, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>) [node]
23: 0xbad634 v8::internal::Builtin_ObjectDefineProperty(int, v8::internal::Object**, v8::internal::Isolate*) [node]
24: 0x3e5aaf25bf7d 
Aborted (core dumped)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:15 (11 by maintainers)

github_iconTop GitHub Comments

2reactions
matthew-deancommented, Apr 29, 2020

@rgroothuijsen Can you provide a PR, with your test cases along with a write-up of your findings? It would be much appreciated.

0reactions
matthew-deancommented, Jul 16, 2020

Fixed by #3494

Read more comments on GitHub >

github_iconTop Results From Across the Web

yarn build in ReactJS, Allocation failed - JavaScript heap out ...
Finally, I use this: https://stackoverflow.com/a/55378108/3541320. In my package.json the script for build:
Read more >
JavaScript heap out of memory - Snyk Support
This generally occurs on larger projects where the default amount of memory allocated by Node (1.5gb) is insufficient to complete the command successfully....
Read more >
How to solve JavaScript heap out of memory error
To fix JavaScript heap out of memory error, you need to add the --max-old-space-size option when running your npm command. Alternatively, you ...
Read more >
JavaScript Heap Out of Memory - Position Is Everything
JavaScript heap out of memory is a common problem when handling bigger projects. Learn how to manage memory to read and write without...
Read more >
How to Fix JavaScript Heap Out of Memory Error - MakeUseOf
If you're running a relatively-large project, it may require more memory than the default allocated chunk. This may cause your project to crash ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found