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

FATAL ERROR: v8::ToLocalChecked Empty MaybeLocal. #42407

Closed
SheetJSDev opened this issue Mar 20, 2022 · 1 comment · Fixed by #42409
Closed

FATAL ERROR: v8::ToLocalChecked Empty MaybeLocal. #42407

SheetJSDev opened this issue Mar 20, 2022 · 1 comment · Fixed by #42409

Comments

@SheetJSDev
Copy link
Contributor

Version

v16.14.2

Platform

Darwin home.home 21.1.0 Darwin Kernel Version 21.1.0: Wed Oct 13 17:33:23 PDT 2021; root:xnu-8019.41.5~1/RELEASE_X86_64 x86_64

Subsystem

No response

What steps will reproduce the bug?

in the REPL:

> var buf = Buffer.from({length:200e6},(_,i) => i%256)
undefined
> console.time("doit"); var ss = buf.toString("binary"); console.timeEnd("doit")
doit: 102.707ms
undefine
> ss.

How often does it reproduce? Is there a required condition?

always

What is the expected behavior?

One of two possibilities:

A) early error ("out of memory") in toString during the second line

B) no error

What do you see instead?

Error is triggered after typing ss.:

FATAL ERROR: v8::ToLocalChecked Empty MaybeLocal.
 1: 0x10303ca25 node::Abort() (.cold.1) [/usr/local/bin/node]
 2: 0x101d320f9 node::Abort() [/usr/local/bin/node]
 3: 0x101d3226f node::OnFatalError(char const*, char const*) [/usr/local/bin/node]
 4: 0x101eb55e0 v8::V8::ToLocalEmpty() [/usr/local/bin/node]
 5: 0x101e1a757 node::inspector::(anonymous namespace)::JSBindingsConnection<node::inspector::(anonymous namespace)::LocalConnection>::JSBindingsSessionDelegate::SendMessageToFrontend(v8_inspector::StringView const&) [/usr/local/bin/node]
 6: 0x101e104db node::inspector::(anonymous namespace)::ChannelImpl::sendResponse(int, std::__1::unique_ptr<v8_inspector::StringBuffer, std::__1::default_delete<v8_inspector::StringBuffer> >) [/usr/local/bin/node]
 7: 0x10249a607 non-virtual thunk to v8_inspector::V8InspectorSessionImpl::SendProtocolResponse(int, std::__1::unique_ptr<v8_crdtp::Serializable, std::__1::default_delete<v8_crdtp::Serializable> >) [/usr/local/bin/node]
 8: 0x1024c80d5 v8_crdtp::DomainDispatcher::sendResponse(int, v8_crdtp::DispatchResponse const&, std::__1::unique_ptr<v8_crdtp::Serializable, std::__1::default_delete<v8_crdtp::Serializable> >) [/usr/local/bin/node]
 9: 0x1024c7f7b v8_crdtp::DomainDispatcher::Callback::sendIfActive(std::__1::unique_ptr<v8_crdtp::Serializable, std::__1::default_delete<v8_crdtp::Serializable> >, v8_crdtp::DispatchResponse const&) [/usr/local/bin/node]
10: 0x1026e6947 v8_inspector::protocol::Runtime::EvaluateCallbackImpl::sendSuccess(std::__1::unique_ptr<v8_inspector::protocol::Runtime::RemoteObject, std::__1::default_delete<v8_inspector::protocol::Runtime::RemoteObject> >, v8_crdtp::detail::PtrMaybe<v8_inspector::protocol::Runtime::ExceptionDetails>) [/usr/local/bin/node]
11: 0x1024a3dbd v8_inspector::V8RuntimeAgentImpl::evaluate(v8_inspector::String16 const&, v8_crdtp::detail::ValueMaybe<v8_inspector::String16>, v8_crdtp::detail::ValueMaybe<bool>, v8_crdtp::detail::ValueMaybe<bool>, v8_crdtp::detail::ValueMaybe<int>, v8_crdtp::detail::ValueMaybe<bool>, v8_crdtp::detail::ValueMaybe<bool>, v8_crdtp::detail::ValueMaybe<bool>, v8_crdtp::detail::ValueMaybe<bool>, v8_crdtp::detail::ValueMaybe<bool>, v8_crdtp::detail::ValueMaybe<double>, v8_crdtp::detail::ValueMaybe<bool>, v8_crdtp::detail::ValueMaybe<bool>, v8_crdtp::detail::ValueMaybe<bool>, v8_crdtp::detail::ValueMaybe<v8_inspector::String16>, std::__1::unique_ptr<v8_inspector::protocol::Runtime::Backend::EvaluateCallback, std::__1::default_delete<v8_inspector::protocol::Runtime::Backend::EvaluateCallback> >) [/usr/local/bin/node]
12: 0x1026df64c v8_inspector::protocol::Runtime::DomainDispatcherImpl::evaluate(v8_crdtp::Dispatchable const&) [/usr/local/bin/node]
13: 0x1024c8a38 v8_crdtp::UberDispatcher::DispatchResult::Run() [/usr/local/bin/node]
14: 0x10249b652 v8_inspector::V8InspectorSessionImpl::dispatchProtocolMessage(v8_inspector::StringView) [/usr/local/bin/node]
15: 0x101e10eee node::inspector::NodeInspectorClient::dispatchMessageFromFrontend(int, v8_inspector::StringView const&) [/usr/local/bin/node]
16: 0x101e10b3a node::inspector::(anonymous namespace)::SameThreadInspectorSession::Dispatch(v8_inspector::StringView const&) [/usr/local/bin/node]
17: 0x101e1968f node::inspector::(anonymous namespace)::JSBindingsConnection<node::inspector::(anonymous namespace)::LocalConnection>::Dispatch(v8::FunctionCallbackInfo<v8::Value> const&) [/usr/local/bin/node]
18: 0x101f1c219 v8::internal::FunctionCallbackArguments::Call(v8::internal::CallHandlerInfo) [/usr/local/bin/node]
19: 0x101f1bce6 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]
20: 0x101f1b45f v8::internal::Builtin_HandleApiCall(int, unsigned long*, v8::internal::Isolate*) [/usr/local/bin/node]
21: 0x10278e959 Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_BuiltinExit [/usr/local/bin/node]
22: 0x10cc9e4a1 

Additional information

NodeJS will handle general ASCII strings of at least double that length in the REPL:

> var ss = "a".repeat(400e6)
undefined
> ss.length
400000000

The timing suggests an early failure under the hood that is not properly percolated to the JS layer.

RaisinTen added a commit to RaisinTen/node that referenced this issue Mar 20, 2022
Return early when the Inspector StringView to V8 String conversion fails
and returns an empty MaybeLocal instead of running the invalid
ToLocalChecked() assertion.

Fixes: nodejs#42407
Signed-off-by: Darshan Sen <raisinten@gmail.com>
@RaisinTen
Copy link
Contributor

PR: #42409

nodejs-github-bot pushed a commit that referenced this issue Apr 9, 2022
Return early when the Inspector StringView to V8 String conversion fails
and returns an empty MaybeLocal instead of running the invalid
ToLocalChecked() assertion.

Fixes: #42407
Signed-off-by: Darshan Sen <raisinten@gmail.com>

PR-URL: #42409
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
xtx1130 pushed a commit to xtx1130/node that referenced this issue Apr 25, 2022
Return early when the Inspector StringView to V8 String conversion fails
and returns an empty MaybeLocal instead of running the invalid
ToLocalChecked() assertion.

Fixes: nodejs#42407
Signed-off-by: Darshan Sen <raisinten@gmail.com>

PR-URL: nodejs#42409
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Dossar pushed a commit to Dossar/node that referenced this issue May 26, 2022
Return early when the Inspector StringView to V8 String conversion fails
and returns an empty MaybeLocal instead of running the invalid
ToLocalChecked() assertion.

Fixes: nodejs#42407
Signed-off-by: Darshan Sen <raisinten@gmail.com>

PR-URL: nodejs#42409
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
juanarbol pushed a commit that referenced this issue May 31, 2022
Return early when the Inspector StringView to V8 String conversion fails
and returns an empty MaybeLocal instead of running the invalid
ToLocalChecked() assertion.

Fixes: #42407
Signed-off-by: Darshan Sen <raisinten@gmail.com>

PR-URL: #42409
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
juanarbol pushed a commit that referenced this issue May 31, 2022
Return early when the Inspector StringView to V8 String conversion fails
and returns an empty MaybeLocal instead of running the invalid
ToLocalChecked() assertion.

Fixes: #42407
Signed-off-by: Darshan Sen <raisinten@gmail.com>

PR-URL: #42409
Backport--PR-URL: #42967
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
juanarbol pushed a commit that referenced this issue Jun 1, 2022
Return early when the Inspector StringView to V8 String conversion fails
and returns an empty MaybeLocal instead of running the invalid
ToLocalChecked() assertion.

Fixes: #42407
Signed-off-by: Darshan Sen <raisinten@gmail.com>

PR-URL: #42409
Backport-PR-URL: #42967
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
BethGriggs pushed a commit that referenced this issue Jun 1, 2022
Return early when the Inspector StringView to V8 String conversion fails
and returns an empty MaybeLocal instead of running the invalid
ToLocalChecked() assertion.

Fixes: #42407
Signed-off-by: Darshan Sen <raisinten@gmail.com>

PR-URL: #42409
Backport-PR-URL: #42967
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
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

Successfully merging a pull request may close this issue.

2 participants