Skip to content
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

ERROR: JavaScript heap out of memory; When value of label is invalid #3

Open
ilabacheuski opened this issue Nov 15, 2017 · 0 comments

Comments

@ilabacheuski
Copy link

ilabacheuski commented Nov 15, 2017

Labels cannot compile when the value with template is invalid and is processed by handlebars.

When some of the value is invalid the node process cannot compile that label and exit with log:

<--- Last few GCs --->

[22286:0x223aeb0]    25933 ms: Mark-sweep 1290.6 (1367.9) -> 1290.5 (1349.9) MB, 992.4 / 0.0 ms  allocation failure GC in old space requested
[22286:0x223aeb0]    26930 ms: Mark-sweep 1290.5 (1349.9) -> 1290.5 (1312.9) MB, 996.9 / 0.0 ms  last resort GC in old space requested
[22286:0x223aeb0]    27856 ms: Mark-sweep 1290.5 (1312.9) -> 1290.5 (1312.9) MB, 925.5 / 0.0 ms  last resort GC in old space requested


<--- JS stacktrace --->

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

Security context: 0x1c951ea5749 <JSObject>
    1: push(this=0x11296b1b5669 <JSArray[33426304]>)
    2: parse [/home/umiranchuk/Projects/project/node_modules/l10ns/libraries/MessageFormat/index.js:~194] [pc=0x2068abd1edfd](this=0xa8ec8e84281 <MessageFormat map = 0x11ef615694b1>,message=0x1e7f57242a1 <String[18]: date} at {time}hrs>)
    3: /* anonymous */ [/home/umiranchuk/Projects/projct/node_modules/l10ns/plugins/han...

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
 1: node::Abort() [node]
 2: 0x11df13c [node]
 3: v8::Utils::ReportOOMFailure(char const*, bool) [node]
 4: v8::internal::V8::FatalProcessOutOfMemory(char const*, bool) [node]
 5: v8::internal::factory::NewUninitializedFixedArray(int) [node]
 6: 0xde93bf [node]
 7: 0xdfd2e5 [node]
 8: v8::internal::JSObject::AddDataElement(v8::internal::Handle<v8::internal::JSObject>, unsigned int, v8::internal::Handle<v8::internal::Object>, v8::internal::PropertyAttributes, v8::internal::Object::ShouldThrow) [node]
 9: v8::internal::Object::AddDataProperty(v8::internal::LookupIterator*, v8::internal::Handle<v8::internal::Object>, v8::internal::PropertyAttributes, v8::internal::Object::ShouldThrow, v8::internal::Object::StoreFromKeyed) [node]
10: v8::internal::Object::SetProperty(v8::internal::LookupIterator*, v8::internal::Handle<v8::internal::Object>, v8::internal::LanguageMode, v8::internal::Object::StoreFromKeyed) [node]
11: v8::internal::Runtime_SetProperty(int, v8::internal::Object**, v8::internal::Isolate*) [node]
12: 0x2068abb842fd
Aborted (core dumped)

The issue is in json file with label that has the key 'value'. In that key is stored something wrong like:
date} at {time}hrs but should be {date} at {time}hrs

Might be it is a good idea to validate json file before parsing it and processing

Example of wrong json:

{   
     "id": "hotel.checkOutDate",
     "key": "hotel.checkOutDate",
    "value": "date} at {time}hrs"
}

Repo to reproduce the hanging of 10ns. It does not provide the same error, but demonstrates the problem:

https://github.com/ilabacheuski/l10ns-memory-leak

git clone https://github.com/ilabacheuski/l10ns-memory-leak.git
cd l10ns-memory-leak
npm i -g l10ns
echo ">>> After this step the process will hang on"
l10ns compile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant