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

bug(print-source): libc++abi: terminating with uncaught exception #422

Open
tony-go opened this issue Sep 28, 2022 · 0 comments
Open

bug(print-source): libc++abi: terminating with uncaught exception #422

tony-go opened this issue Sep 28, 2022 · 0 comments

Comments

@tony-go
Copy link
Member

tony-go commented Sep 28, 2022

Describe the bug
llnode crashes when I run v8 i -s <addr>.

To reproduce

  • Having this file crash.js
'use strict';

throw new Error('this is uncaught');
  • Running node --abort-on-uncaught-exception crash.js
  • Loaded core with llnode node/location -c core/location
  • Ran command v8 bt:
(llnode) v8 bt
 * thread #1: tid = 0x0000, 0x0000000101756ca5 node`v8::base::OS::Abort() (.cold.1) + 5
  * frame #0: 0x0000000101756ca5 node`v8::base::OS::Abort() (.cold.1) + 5
    frame #1: 0x000000010147fa77 node`v8::base::OS::Abort() + 23
    frame #2: 0x00000001006e10bb node`v8::internal::Isolate::CreateMessageOrAbort(v8::internal::Handle<v8::internal::Object>, v8::internal::MessageLocation*) + 171
    frame #3: 0x00000001006e0aae node`v8::internal::Isolate::ThrowInternal(v8::internal::Object, v8::internal::MessageLocation*) + 958
    frame #4: 0x0000000100ae0ecf node`v8::internal::Runtime_Throw(int, unsigned long*, v8::internal::Isolate*) + 47
    frame #5: 0x0000000100e8b319 <exit>
    frame #6: 0x0000000100f20d5a <stub>
    frame #7: 0x0000000100e1ddea (this=0x2f03a76913e9:<Object: Object>, 0x2f03a76913e9:<Object: Object>, 0x2f03a7693201:<function: require at node:internal/modules/cjs/helpers:1:10>, 0x2f03a76911e1:<Object: Module>, 0x2f03a768f159:<String: "/Users/jamiamer/...">, 0x2f03a7693131:<String: "/Users/jamiamer/...">) at /Users/jamiamer/projects/llnode-tuto/simple-crash.js:1:0 fn=0x00002f03a7692e11
...
  • Ran command v8 i -s 0x2f03a7693201:
  • Crash.

Expected behavior
Having the source of the function printed in the console.

Console output

(llnode) v8 i -s 0x2f03a7693201
libc++abi: terminating with uncaught exception of type std::out_of_range: basic_string
PLEASE submit a bug report to https://developer.apple.com/bug-reporting/ and include the crash backtrace.
Stack dump:
0.	Program arguments: /Library/Developer/CommandLineTools/usr/bin/lldb --one-line "plugin load '/usr/local/Cellar/llnode/4.0.0/lib/node_modules/llnode/llnode.dylib'" --one-line "settings set prompt '(llnode) '" node -c /cores/core.1403
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0  lldb                     0x0000000100695357 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 39
1  lldb                     0x0000000100694a85 llvm::sys::RunSignalHandlers() + 85
2  lldb                     0x0000000100695a00 SignalHandler(int) + 288
3  libsystem_platform.dylib 0x00007ff8174e6dfd _sigtramp + 29
4  libsystem_platform.dylib 0x00007f7e00000400 _sigtramp + 18446743549332526624
5  libsystem_c.dylib        0x00007ff81741cd24 abort + 123
6  libc++abi.dylib          0x00007ff81748d082 abort_message + 241
7  libc++abi.dylib          0x00007ff81747e1a5 demangling_terminate_handler() + 242
8  libobjc.A.dylib          0x00007ff81737ae19 _objc_terminate() + 104
9  libc++abi.dylib          0x00007ff81748c4a7 std::__terminate(void (*)()) + 8
10 libc++abi.dylib          0x00007ff81748ed05 __cxa_get_exception_ptr + 0
11 libc++abi.dylib          0x00007ff81748eccc __cxxabiv1::exception_cleanup_func(_Unwind_Reason_Code, _Unwind_Exception*) + 0
12 libc++.1.dylib           0x00007ff817432a34 std::__1::__throw_out_of_range(char const*) + 56
13 libc++.1.dylib           0x00007ff8174329fc std::__1::__throw_out_of_range(char const*) + 0
14 libc++.1.dylib           0x00007ff817432c1d std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__throw_out_of_range() const + 9
15 libc++.1.dylib           0x00007ff817433ae8 std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, unsigned long, unsigned long, std::__1::allocator<char> const&) + 174
16 llnode.dylib             0x00000001085614a7 llnode::v8::JSFunction::GetSource(llnode::Error&) + 975
17 llnode.dylib             0x000000010857bcb2 std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > llnode::Printer::Stringify<llnode::v8::JSFunction, llnode::v8::JSFunction>(llnode::v8::JSFunction, llnode::Error&) + 1970
18 llnode.dylib             0x0000000108579140 std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > llnode::Printer::Stringify<llnode::v8::HeapObject, llnode::v8::HeapObject>(llnode::v8::HeapObject, llnode::Error&) + 2464
19 llnode.dylib             0x00000001085785a9 std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > llnode::Printer::Stringify<llnode::v8::Value, llnode::v8::Value>(llnode::v8::Value, llnode::Error&) + 375
20 llnode.dylib             0x00000001085561c6 llnode::PrintCmd::DoExecute(lldb::SBDebugger, char**, lldb::SBCommandReturnObject&) + 566
21 LLDB                     0x0000000117ae28fa CommandPluginInterfaceImplementation::DoExecute(lldb_private::Args&, lldb_private::CommandReturnObject&) + 282
22 LLDB                     0x0000000117cd57aa lldb_private::CommandObjectParsed::Execute(char const*, lldb_private::CommandReturnObject&) + 410
23 LLDB                     0x0000000117cca866 lldb_private::CommandInterpreter::HandleCommand(char const*, lldb_private::LazyBool, lldb_private::CommandReturnObject&) + 2278
24 LLDB                     0x0000000117ccf458 lldb_private::CommandInterpreter::IOHandlerInputComplete(lldb_private::IOHandler&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&) + 920
25 LLDB                     0x0000000117bf6d3a lldb_private::IOHandlerEditline::Run() + 346
26 LLDB                     0x0000000117bd9fdf lldb_private::Debugger::RunIOHandlers() + 143
27 LLDB                     0x0000000117cd08ae lldb_private::CommandInterpreter::RunCommandInterpreter(lldb_private::CommandInterpreterRunOptions&) + 158
28 LLDB                     0x0000000117afa61c lldb::SBDebugger::RunCommandInterpreter(bool, bool) + 140
29 lldb                     0x0000000100685668 Driver::MainLoop() + 2600
30 lldb                     0x000000010068656b main + 2523
31 dyld                     0x000000010867c52e start + 462

Local environment (please complete the following information):

  • Version of llnode: 4.0.0
  • OS Info: Macbook pro (2015) - MacOs Monterey 12.5.1 (intel)
  • lldb Version: lldb-1400.0.30.3
  • Version of node.js: 16.17.0

Server where the core was dumped (please complete the following information):
Same as above.

Additional context

@tony-go tony-go changed the title bug(inspect -s): libc++abi: terminating with uncaught exception bug(print-source): libc++abi: terminating with uncaught exception Sep 28, 2022
kvakil added a commit to kvakil/llnode that referenced this issue Oct 1, 2022
This "fixes" the segfault reported in nodejs#422, in the sense that you no
longer get a segfault. However the printing does not actually work, i.e.
you currently get an error like this:

```console
(lldb) v8 i -s 0x2196b1a09a29
error: Invalid source range, start_pos=3108, len=-3098, source_len=10
```

I'm deeming this better than segfaulting. We should really never be
segfaulting as the coredump might be incomplete/partially corrupted.
(Also, we already know function printing on v16 doesn't work right now.)
kvakil added a commit to kvakil/llnode that referenced this issue Oct 1, 2022
This "fixes" the crash reported in nodejs#422, in the sense that you no longer
get a crash. However the printing does not actually work, i.e. you
currently get an error like this:

```console
(lldb) v8 i -s 0x2196b1a09a29
error: Invalid source range, start_pos=3108, len=-3098, source_len=10
```

I'm deeming this better than crashing. We should really never be
crashing as the coredump might be incomplete/partially corrupted.
(Also, we already know function printing on v16 doesn't work right now.)
No9 pushed a commit that referenced this issue Oct 18, 2022
This "fixes" the crash reported in #422, in the sense that you no longer
get a crash. However the printing does not actually work, i.e. you
currently get an error like this:

```console
(lldb) v8 i -s 0x2196b1a09a29
error: Invalid source range, start_pos=3108, len=-3098, source_len=10
```

I'm deeming this better than crashing. We should really never be
crashing as the coredump might be incomplete/partially corrupted.
(Also, we already know function printing on v16 doesn't work right now.)
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