Node js crashes with native exception - node.js

I am getting unexpected exits (exit code 1) - and stalls ie promises never fulfilled - in a node application. Most of the times this happens, there is no error visible, however, I have seen the following stack trace on one occasion:
#
# Fatal error in , line 0
# Check failed: fixed_size_above_fp + (stack_slots * kSystemPointerSize) - CommonFrameConstants::kFixedFrameSizeAboveFp + outgoing_size == result.
#
#
#
#FailureMessage Object: 0x7ffeefbfc9e0
1: 0x100120e62 node::NodePlatform::GetStackTracePrinter()::$_3::__invoke() [/usr/local/bin/node]
2: 0x10103af53 V8_Fatal(char const*, ...) [/usr/local/bin/node]
3: 0x10030a633 v8::internal::Deoptimizer::Deoptimizer(v8::internal::Isolate*, v8::internal::JSFunction, v8::internal::DeoptimizeKind, unsigned int, unsigned long, int) [/usr/local/bin/node]
4: 0x10030839e v8::internal::Deoptimizer::New(unsigned long, v8::internal::DeoptimizeKind, unsigned int, unsigned long, int, v8::internal::Isolate*) [/usr/local/bin/node]
5: 0x34a8fad8216d
6: 0x1006c5e23 v8::internal::NativeRegExpMacroAssembler::Execute(v8::internal::String, int, unsigned char const*, unsigned char const*, int*, int, v8::internal::Isolate*, v8::internal::JSRegExp) [/usr/local/bin/node]
7: 0x1006c5d66 v8::internal::NativeRegExpMacroAssembler::Match(v8::internal::Handle<v8::internal::JSRegExp>, v8::internal::Handle<v8::internal::String>, int*, int, int, v8::internal::Isolate*) [/usr/local/bin/node]
8: 0x1006d22ad v8::internal::RegExpImpl::IrregexpExecRaw(v8::internal::Isolate*, v8::internal::Handle<v8::internal::JSRegExp>, v8::internal::Handle<v8::internal::String>, int, int*, int) [/usr/local/bin/node]
9: 0x1006d2967 v8::internal::RegExpGlobalCache::FetchNext() [/usr/local/bin/node]
10: 0x100725666 v8::internal::Runtime_RegExpExecMultiple(int, unsigned long*, v8::internal::Isolate*) [/usr/local/bin/node]
11: 0x100a81fb9 Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_NoBuiltinExit [/usr/local/bin/node]
12: 0x100ad1c5a Builtins_RegExpReplace [/usr/local/bin/node]
13: 0x100a72e52 Builtins_StringPrototypeReplace [/usr/local/bin/node]
I'm not sure quite what to make of this, as the exits appear to happen at different points. Does the above seem likely to be a memory problem?

Related

I am doing an api call and the client is returning a response so big that node crashes

This is the error I am dealing with
#
# Fatal error in , line 0
# Check failed: i::kMaxInt >= len.
#
#
#
#FailureMessage Object: 0x7ffd4a155b80
1: 0xb6d391 [node]
2: 0x1bf6a04 V8_Fatal(char const*, ...) [node]
3: 0xcfcd77 v8::String::NewFromUtf8(v8::Isolate*, char const*, v8::NewStringType, int) [node]
4: 0xbeb719 [node]
5: 0xadb345 [node]
6: 0xd4a82e [node]
7: 0xd4bc4f v8::internal::Builtin_HandleApiCall(int, unsigned long*, v8::internal::Isolate*) [node]
8: 0x15e7dd9 [node]
Any assitance here would be greatly appreciated.
Ive tried paging size which does fix this problem because this is on an individual record

random crash in our node app with fatal error

my node program is crashing with the following error. Tried on both node v14.18.1 and v16.13.0.
#
# Fatal error in , line 0
# Check failed: i::kMaxInt >= len.
#
#
#
#FailureMessage Object: 0x7ffd97a48d20
1: 0xaa6321 [node]
2: 0x1a3b274 V8_Fatal(char const*, ...) [node]
3: 0xbcec79 v8::String::NewFromUtf8(v8::Isolate*, char const*, v8::NewStringType, int) [node]
4: 0xb1c319 [node]
5: 0xa14671 [node]
6: 0xc238db [node]
7: 0xc24e86 [node]
8: 0xc25506 v8::internal::Builtin_HandleApiCall(int, unsigned long*, v8::internal::Isolate*) [node]
9: 0x1446459 [node]
Since there's v8::String::NewFromUtf8 on the stack, and Check failed: i::kMaxInt >= len in the error message, it's pretty clear that your string is too long. On 64-bit platforms, the max string length that V8 supports is ~536 million characters.

Unexpected error during building next.js project

When I try to build my next.js project I am getting this error:
> next build
info - Creating an optimized production build...
info - Compiled successfully
info - Collecting page data...
info - Generating static pages (0/5)
info - Generating static pages (1/5)
info - Generating static pages (2/5)
info - Generating static pages (3/5)
info - Generating static pages (5/5)
info - Finalizing page optimization...
FATAL ERROR: v8::HandleScope::CreateHandle() Cannot create a handle without a HandleScope
1: 0xa89e60 node::Abort() [node]
2: 0x9ade29 node::FatalError(char const*, char const*) [node]
3: 0xc7555a v8::Utils::ReportApiFailure(char const*, char const*) [node]
4: 0xdfdde2 v8::internal::HandleScope::Extend(v8::internal::Isolate*) [node]
5: 0xe10b7c v8::internal::FactoryBase<v8::internal::Factory>::NewRawOneByteString(int, v8::internal::AllocationType) [node]
6: 0xe22b8e v8::internal::Factory::NewStringFromOneByte(v8::internal::Vector<unsigned char const> const&, v8::internal::AllocationType) [node]
7: 0xc8cf72 v8::String::NewFromOneByte(v8::Isolate*, unsigned char const*, v8::NewStringType, int) [node]
8: 0xc3a317 node::crypto::TLSWrap::InvokeQueued(int, char const*) [node]
9: 0xc3a422 [node]
10: 0xc3a5e4 node::crypto::TLSWrap::~TLSWrap() [node]
11: 0xc3a751 node::crypto::TLSWrap::~TLSWrap() [node]
12: 0xa20c5b node::Environment::RunCleanup() [node]
13: 0x9d670c node::FreeEnvironment(node::Environment*) [node]
14: 0xb52249 node::worker::Worker::Run() [node]
15: 0xb529c8 [node]
16: 0x7ff424e31609 [/lib/x86_64-linux-gnu/libpthread.so.0]
17: 0x7ff424d58293 clone [/lib/x86_64-linux-gnu/libc.so.6]
Aborted
-----> Build failed
Node version: 15.14.0
Npm version: 7.7.6
I do not know why this is failing. It works randomly on local machine an always fails on Heroku. I can't find any solution or related problem.

Why do I keep getting an Out-Of-Memory error with Redux-Persist?

Occasionally when rebooting my app, my emulator throws this error
Accompanied by this stacktrace
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
1: node::Abort() [/usr/local/bin/node]
2: node::FatalException(v8::Isolate*, v8::Local<v8::Value>, v8::Local<v8::Message>) [/usr/local/bin/node]
3: v8::Utils::ReportOOMFailure(char const*, bool) [/usr/local/bin/node]
4: v8::internal::V8::FatalProcessOutOfMemory(char const*, bool) [/usr/local/bin/node]
5: v8::internal::Factory::NewRawTwoByteString(int, v8::internal::PretenureFlag) [/usr/local/bin/node]
6: v8::internal::String::SlowFlatten(v8::internal::Handle<v8::internal::ConsString>, v8::internal::PretenureFlag) [/usr/local/bin/node]
7: v8::String::WriteUtf8(char*, int, int*, int) const [/usr/local/bin/node]
8: node::StringBytes::Write(v8::Isolate*, char*, unsigned long, v8::Local<v8::Value>, node::encoding, int*) [/usr/local/bin/node]
9: int node::StreamBase::WriteString<(node::encoding)1>(v8::FunctionCallbackInfo<v8::Value> const&) [/usr/local/bin/node]
10: void node::StreamBase::JSMethod<node::LibuvStreamWrap, &(int node::StreamBase::WriteString<(node::encoding)1>(v8::FunctionCallbackInfo<v8::Value> const&))>(v8::FunctionCallbackInfo<v8::Value> const&) [/usr/local/bin/node]
11: v8::internal::FunctionCallbackArguments::Call(void (*)(v8::FunctionCallbackInfo<v8::Value> const&)) [/usr/local/bin/node]
12: v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<false>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::internal::Handle<v8::internal::Object>, v8::internal::BuiltinArguments) [/usr/local/bin/node]
13: v8::internal::Builtin_Impl_HandleApiCall(v8::internal::BuiltinArguments, v8::internal::Isolate*) [/usr/local/bin/node]
14: 0x2672e7c842fd
events.js:183
throw er; // Unhandled 'error' event
^
Error: write EPIPE
at WriteWrap.afterWrite [as oncomplete] (net.js:868:14)
/Users/jisata0/Dev/exampleapp/node_modules/react-native/scripts/packager.sh: line 11: 86698 Abort trap: 6 node "./local-cli/cli.js" start "$#"
Process terminated. Press <enter> to close the window
Can anyone provide some clarity on why this might be happening?
A client is required to review the basic application response to performance improvements. One of the most common causes of performance problems is memory leak.
Out of memory is an error that occurs when the limit of available memory is exceeded.
The simplest way to apply it is to have more memory available to the app.
You can use Add to android / app / src / main / AndroidManifest.xml.
<application android:largeHeap="true"
If you still have out of memory, try debugging any code you've written that uses more memory than you intended or creates a memory lock.

Node js memory heap out on file upload

I am trying to upload a file sized 200MB using angular5 node js. Every time the app crashed with following error.
==== JS stack trace =========================================
Security context: 0x2c3a92b25ee1 <JSObject>
2: SimpleSlice(aka SimpleSlice) [native array.js:1] [bytecode=0x2c3aa14ed689 offset=41](this=0x2c3ad9b02311 <undefined>,p=0x2c3a51d2e961 <Uint8Array map = 0x2c3ad7ec1d91>,O=0,P=217330529,Q=217330529,R=0x2c3a51d6bce1 <JSArray[217330529]>)
4: ArraySliceFallback [native array.js:1] [bytecode=0x2c3aa14ed021 offset=281](this=0x2c3a51d2e961 <Uint8Array map = 0x2c3ad7ec1d91>,at=0,au=0x2c3ad9b02...
FATAL ERROR: invalid table size Allocation failed - JavaScript heap out of memory
1: node::Abort() [/usr/local/bin/node]
2: node::FatalException(v8::Isolate*, v8::Local<v8::Value>, v8::Local<v8::Message>) [/usr/local/bin/node]
3: v8::internal::V8::FatalProcessOutOfMemory(char const*, bool) [/usr/local/bin/node]
4: v8::internal::HashTable<v8::internal::SeededNumberDictionary, v8::internal::SeededNumberDictionaryShape>::EnsureCapacity(v8::internal::Handle<v8::internal::SeededNumberDictionary>, int, v8::internal::PretenureFlag) [/usr/local/bin/node]
5: v8::internal::Dictionary<v8::internal::SeededNumberDictionary, v8::internal::SeededNumberDictionaryShape>::Add(v8::internal::Handle<v8::internal::SeededNumberDictionary>, unsigned int, v8::internal::Handle<v8::internal::Object>, v8::internal::PropertyDetails, int*) [/usr/local/bin/node]
6: v8::internal::(anonymous namespace)::DictionaryElementsAccessor::AddImpl(v8::internal::Handle<v8::internal::JSObject>, unsigned int, v8::internal::Handle<v8::internal::Object>, v8::internal::PropertyAttributes, unsigned int) [/usr/local/bin/node]
7: 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) [/usr/local/bin/node]
8: v8::internal::JSObject::DefineOwnPropertyIgnoreAttributes(v8::internal::LookupIterator*, v8::internal::Handle<v8::internal::Object>, v8::internal::PropertyAttributes, v8::internal::Object::ShouldThrow, v8::internal::JSObject::AccessorInfoHandling) [/usr/local/bin/node]
9: v8::internal::JSObject::CreateDataProperty(v8::internal::LookupIterator*, v8::internal::Handle<v8::internal::Object>, v8::internal::Object::ShouldThrow) [/usr/local/bin/node]
10: v8::internal::Runtime_CreateDataProperty(int, v8::internal::Object**, v8::internal::Isolate*) [/usr/local/bin/node]
11: 0x12f2c16c6838
I have tried different techniques but all in vein.
--max-old-space-size=80896 --trace-gc-verbose
app.use(bodyParser.json({limit: '8096mb'}));
In activity monitoring when node grab more than 1GB the crash happen.
My development environment is mac with 8 GB ram.

Resources