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

net-libs/nodejs (14.14.0) dumps core on node_mksnapshot #1

Closed
jhamby opened this issue Oct 31, 2020 · 5 comments
Closed

net-libs/nodejs (14.14.0) dumps core on node_mksnapshot #1

jhamby opened this issue Oct 31, 2020 · 5 comments
Assignees

Comments

@jhamby
Copy link
Owner

jhamby commented Oct 31, 2020

I'm currently trying to figure out why I can't emerge Node.js on my G5. I'm pretty sure the code generator recognizes that I have Altivec but is generating instructions that my G5 can't execute. Here's the crash I'm seeing.

LD_LIBRARY_PATH=/var/tmp/portage/net-libs/nodejs-14.14.0/work/node-v14.14.0/out/Release/lib.host:/var/tmp/portage/net-libs/nodejs-14.14.0/work/node-v14.14.0/out/Release/lib.target:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH; cd ../.; mkdir -p /var/tmp/portage/net-libs/nodejs-14.14.0/work/node-v14.14.0/out/Release/obj/gen; "/var/tmp/portage/net-libs/nodejs-14.14.0/work/node-v14.14.0/out/Release/node_mksnapshot" "/var/tmp/portage/net-libs/nodejs-14.14.0/work/node-v14.14.0/out/Release/obj/gen/node_snapshot.cc"
/bin/sh: line 1: 21783 Segmentation fault (core dumped) "/var/tmp/portage/net-libs/nodejs-14.14.0/work/node-v14.14.0/out/Release/node_mksnapshot" "/var/tmp/portage/net-libs/nodejs-14.14.0/work/node-v14.14.0/out/Release/obj/gen/node_snapshot.cc"
make: *** [node.target.mk:26: /var/tmp/portage/net-libs/nodejs-14.14.0/work/node-v14.14.0/out/Release/obj/gen/node_snapshot.cc] Error 139

The stack backtrace only goes up to where it executes the generated code.

I'll append to this bug once I have more idea what's going on. I need to fix this in order to build Firefox as well as Chromium.

@jhamby jhamby self-assigned this Oct 31, 2020
@jhamby
Copy link
Owner Author

jhamby commented Oct 31, 2020

This time I tried building with "debug" and got more info about what may be going wrong.

 * Package:    net-libs/nodejs-14.14.0
 * Repository: gentoo
 * Maintainer: [email protected]
 * USE:        abi_ppc_64 debug elibc_glibc icu inspector kernel_linux npm ppc64 snapshot ssl system-ssl userland_GNU
 * FEATURES:   network-sandbox nostrip preserve-libs sandbox test userpriv usersandbox
 * Using python3.7 to build

  LD_LIBRARY_PATH=/var/tmp/portage/net-libs/nodejs-14.14.0/work/node-v14.14.0/out/Debug/lib.host:/var/tmp/portage/net-libs/nodejs-14.14.0/work/node-v14.14.0/out/Debug/lib.target:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH; cd ../tools/v8_gypfiles; mkdir -p /var/tmp/portage/net-libs/nodejs-14.14.0/work/node-v14.14.0/out/Debug/obj.target/v8_snapshot/geni; "/var/tmp/portage/net-libs/nodejs-14.14.0/work/node-v14.14.0/out/Debug/mksnapshot" --turbo_instruction_scheduling "--target_os=linux" "--target_arch=ppc64" --startup_src "/var/tmp/portage/net-libs/nodejs-14.14.0/work/node-v14.14.0/out/Debug/obj.target/v8_snapshot/geni/snapshot.cc" --embedded_variant Default --embedded_src "/var/tmp/portage/net-libs/nodejs-14.14.0/work/node-v14.14.0/out/Debug/obj.target/v8_snapshot/geni/embedded.S" --no-native-code-counters


#
# Fatal error in ../deps/v8/src/utils/allocation.cc, line 168
# Debug check failed: hint == AlignedAddress(hint, alignment) (0xdeaf5f4000 vs. 0xdeaf5f0000).
#
#
#
#FailureMessage Object: 0x3fffcefffd38
==== C stack trace ===============================

    /var/tmp/portage/net-libs/nodejs-14.14.0/work/node-v14.14.0/out/Debug/mksnapshot(v8::base::debug::StackTrace::StackTrace()-0x5c9dac) [0x1065dcb7c]
    /var/tmp/portage/net-libs/nodejs-14.14.0/work/node-v14.14.0/out/Debug/mksnapshot(+0x1808e78) [0x10586be78]
    /var/tmp/portage/net-libs/nodejs-14.14.0/work/node-v14.14.0/out/Debug/mksnapshot(V8_Fatal(char const*, int, char const*, ...)-0x12e4d30) [0x10585da28]
    /var/tmp/portage/net-libs/nodejs-14.14.0/work/node-v14.14.0/out/Debug/mksnapshot(+0x17faa70) [0x10585da70]
    /var/tmp/portage/net-libs/nodejs-14.14.0/work/node-v14.14.0/out/Debug/mksnapshot(V8_Dcheck(char const*, int, char const*)-0x12e4cd4) [0x10585dab4]
    /var/tmp/portage/net-libs/nodejs-14.14.0/work/node-v14.14.0/out/Debug/mksnapshot(v8::internal::AllocatePages(v8::PageAllocator*, void*, unsigned long, unsigned long, v8::PageAllocator::Permission)-0x18c22b8) [0x105250548]
    /var/tmp/portage/net-libs/nodejs-14.14.0/work/node-v14.14.0/out/Debug/mksnapshot(v8::internal::VirtualMemory::VirtualMemory(v8::PageAllocator*, unsigned long, void*, unsigned long)-0x18c2150) [0x1052506c8]
    /var/tmp/portage/net-libs/nodejs-14.14.0/work/node-v14.14.0/out/Debug/mksnapshot(v8::internal::MemoryAllocator::InitializeCodePageAllocator(v8::PageAllocator*, unsigned long)-0x1dbb6b4) [0x104d2ab3c]
    /var/tmp/portage/net-libs/nodejs-14.14.0/work/node-v14.14.0/out/Debug/mksnapshot(v8::internal::Heap::SetUp()-0x1e7a2a8) [0x104c650a8]
    /var/tmp/portage/net-libs/nodejs-14.14.0/work/node-v14.14.0/out/Debug/mksnapshot(v8::internal::Isolate::Init(v8::internal::ReadOnlyDeserializer*, v8::internal::StartupDeserializer*)-0x1f47280) [0x104b8fec8]
    /var/tmp/portage/net-libs/nodejs-14.14.0/work/node-v14.14.0/out/Debug/mksnapshot(v8::SnapshotCreator::SnapshotCreator(v8::Isolate*, long const*, v8::StartupData*)-0x2120868) [0x10499c528]
    /var/tmp/portage/net-libs/nodejs-14.14.0/work/node-v14.14.0/out/Debug/mksnapshot(v8::internal::CreateSnapshotDataBlobInternal(v8::SnapshotCreator::FunctionCodeHandling, char const*, v8::Isolate*)-0x18e42e4) [0x10522d04c]
    /var/tmp/portage/net-libs/nodejs-14.14.0/work/node-v14.14.0/out/Debug/mksnapshot(main-0x2141548) [0x10497a9c0]
    /lib64/libc.so.6(+0x48e64) [0x3fff8df26e64]
    /lib64/libc.so.6(__libc_start_main-0x1c48a4) [0x3fff8df27074]
/bin/sh: line 1: 21053 Trace/breakpoint trap   (core dumped) "/var/tmp/portage/net-libs/nodejs-14.14.0/work/node-v14.14.0/out/Debug/mksnapshot" --turbo_instruction_scheduling "--target_os=linux" "--target_arch=ppc64" --startup_src "/var/tmp/portage/net-libs/nodejs-14.14.0/work/node-v14.14.0/out/Debug/obj.target/v8_snapshot/geni/snapshot.cc" --embedded_variant Default --embedded_src "/var/tmp/portage/net-libs/nodejs-14.14.0/work/node-v14.14.0/out/Debug/obj.target/v8_snapshot/geni/embedded.S" --no-native-code-counters
make: *** [tools/v8_gypfiles/v8_snapshot.target.mk:17: 44344bb9d9e47589d90d31f402763e5c9a641a8a.intermediate] Error 133

I'm thinking now that the problem may have to do with memory alignment? Very strange. But I'm glad the debug checks caught something before where the release build dumps core.

@jhamby
Copy link
Owner Author

jhamby commented Oct 31, 2020

More details about the first assertion failure I'm hitting in the debug build:

$ sudo coredumpctl debug mksnapshot
           PID: 59508 (mksnapshot)
           UID: 250 (portage)
           GID: 250 (portage)
        Signal: 5 (TRAP)
     Timestamp: Sat 2020-10-31 01:26:35 PDT (8h ago)
  Command Line: /var/tmp/portage/net-libs/nodejs-14.14.0/work/node-v14.14.0/out/Debug/mksnapshot --turbo_instruction_scheduling --target_os=linux --target_arch=ppc64 --startup_src /var/tmp/portage/net-libs/nodejs-14.14.0/work/node-v14.14.0/out/Debug/obj.target/v8_snapshot/geni/snapshot.cc --embedded_variant Default --embedded_src /var/tmp/portage/net-libs/nodejs-14.14.0/work/node-v14.14.0/out/Debug/obj.target/v8_snapshot/geni/embedded.S --no-native-code-counters
    Executable: /var/tmp/portage/net-libs/nodejs-14.14.0/work/node-v14.14.0/out/Debug/mksnapshot
...

Program terminated with signal SIGTRAP, Trace/breakpoint trap.
#0  0x000000010497a55c in v8::base::OS::Abort () at ../deps/v8/src/base/platform/platform-posix.cc:457
457	    V8_IMMEDIATE_CRASH();
[Current thread is 1 (Thread 0x3fff8ed0a010 (LWP 21053))]
(gdb) bt
#0  0x000000010497a55c in v8::base::OS::Abort () at ../deps/v8/src/base/platform/platform-posix.cc:457
#1  0x000000010585da3c in V8_Fatal (file=0x10666b018 "../deps/v8/src/utils/allocation.cc", line=<optimized out>, 
    format=format@entry=0x1066ba038 "Debug check failed: %s.") at ../deps/v8/src/base/logging.cc:167
#2  0x000000010585da70 in v8::base::(anonymous namespace)::DefaultDcheckHandler (file=<optimized out>, line=<optimized out>, message=<optimized out>)
    at ../deps/v8/src/base/logging.cc:57
#3  0x000000010585dab4 in V8_Dcheck (file=<optimized out>, line=<optimized out>, message=<optimized out>) at ../deps/v8/src/base/logging.cc:180
#4  0x0000000105250548 in v8::internal::AllocatePages (page_allocator=page_allocator@entry=0x106c82ba0, hint=hint@entry=0xdeaf5f4000, 
    size=size@entry=536870912, alignment=alignment@entry=65536, access=access@entry=v8::PageAllocator::kNoAccess) at ../deps/v8/src/utils/allocation.cc:168
#5  0x00000001052506c8 in v8::internal::VirtualMemory::VirtualMemory (this=0x3fffcf000280, page_allocator=<optimized out>, size=536870912, hint=0xdeaf5f4000, 
    alignment=<optimized out>) at ../deps/v8/src/base/macros.h:338
#6  0x0000000104d2ab3c in v8::internal::MemoryAllocator::InitializeCodePageAllocator (this=0x106c83870, page_allocator=0x106c82ba0, requested=<optimized out>)
    at ../deps/v8/src/heap/spaces.cc:185
#7  0x0000000104c650a8 in v8::internal::Heap::SetUp (this=0x106c92680) at ../deps/v8/src/heap/heap.cc:5285
#8  0x0000000104b8fec8 in v8::internal::Isolate::Init (this=0x106c89160, read_only_deserializer=0x0, startup_deserializer=0x0)
    at ../deps/v8/src/execution/isolate.cc:3321
#9  0x000000010499c528 in v8::SnapshotCreator::SnapshotCreator (this=0x3fffcf000888, isolate=0x106c89160, external_references=0x0, 
    existing_snapshot=<optimized out>) at ../deps/v8/src/api/api.cc:613
#10 0x000000010522d04c in v8::internal::CreateSnapshotDataBlobInternal (function_code_handling=<optimized out>, embedded_source=0x0, isolate=0x106c89160)
    at ../deps/v8/src/snapshot/snapshot.cc:652
#11 0x000000010497a9c0 in (anonymous namespace)::CreateSnapshotDataBlob (embedded_source=0x0, isolate=0x106c89160) at ../deps/v8/src/snapshot/mksnapshot.cc:151
#12 main (argc=<optimized out>, argv=<optimized out>) at ../deps/v8/src/snapshot/mksnapshot.cc:272

I'm going to try reducing the optimization to -O0 to get more info.

@jhamby
Copy link
Owner Author

jhamby commented Oct 31, 2020

Compiling with "-O0" gave me the same assertion failure, but with a few values that were optimized out. Here's that backtrace:

Core was generated by `/var/tmp/portage/net-libs/nodejs-14.14.0/work/node-v14.14.0/out/Debug/mksnapsho'.
Program terminated with signal SIGTRAP, Trace/breakpoint trap.
#0  v8::base::OS::Abort () at ../deps/v8/src/base/platform/platform-posix.cc:457
457	    V8_IMMEDIATE_CRASH();
[Current thread is 1 (Thread 0x3fff8b143010 (LWP 21053))]
(gdb) bt
#0  v8::base::OS::Abort () at ../deps/v8/src/base/platform/platform-posix.cc:457
#1  0x000000011d1dbc58 in V8_Fatal (file=0x11e406158 "../deps/v8/src/utils/allocation.cc", line=168, format=0x11e556ef0 "Debug check failed: %s.")
    at ../deps/v8/src/base/logging.cc:167
#2  0x000000011d1d9f24 in v8::base::(anonymous namespace)::DefaultDcheckHandler (file=0x11e406158 "../deps/v8/src/utils/allocation.cc", line=168, 
    message=0x11f3be5a0 "hint == AlignedAddress(hint, alignment) (0xdeaf5f4000 vs. 0xdeaf5f0000)") at ../deps/v8/src/base/logging.cc:57
#3  0x000000011d1dbcc4 in V8_Dcheck (file=0x11e406158 "../deps/v8/src/utils/allocation.cc", line=168, 
    message=0x11f3be5a0 "hint == AlignedAddress(hint, alignment) (0xdeaf5f4000 vs. 0xdeaf5f0000)") at ../deps/v8/src/base/logging.cc:180
#4  0x000000011ca45978 in v8::internal::AllocatePages (page_allocator=0x11f371ba0, hint=0xdeaf5f4000, size=536870912, alignment=65536, 
    access=v8::PageAllocator::kNoAccess) at ../deps/v8/src/utils/allocation.cc:168
#5  0x000000011ca461cc in v8::internal::VirtualMemory::VirtualMemory (this=0x3ffffb1fe4b0, page_allocator=0x11f371ba0, size=536870912, hint=0xdeaf5f4000, 
    alignment=65536) at ../deps/v8/src/utils/allocation.cc:223
#6  0x000000011c361948 in v8::internal::MemoryAllocator::InitializeCodePageAllocator (this=0x11f372870, page_allocator=0x11f371ba0, requested=536870912)
    at ../deps/v8/src/heap/spaces.cc:185
#7  0x000000011c361548 in v8::internal::MemoryAllocator::MemoryAllocator (this=0x11f372870, isolate=0x11f378160, capacity=1518338048, code_range_size=0)
    at ../deps/v8/src/heap/spaces.cc:151
#8  0x000000011c1c5ac4 in v8::internal::Heap::SetUp (this=0x11f381680) at ../deps/v8/src/heap/heap.cc:5285
#9  0x000000011c097bac in v8::internal::Isolate::Init (this=0x11f378160, read_only_deserializer=0x0, startup_deserializer=0x0)
    at ../deps/v8/src/execution/isolate.cc:3321
#10 0x000000011c096e28 in v8::internal::Isolate::InitWithoutSnapshot (this=0x11f378160) at ../deps/v8/src/execution/isolate.cc:3215
#11 0x000000011bd8e940 in v8::SnapshotCreator::SnapshotCreator (this=0x3ffffb1feb30, isolate=0x11f378160, external_references=0x0, existing_snapshot=0x0)
    at ../deps/v8/src/api/api.cc:613
#12 0x000000011ca20348 in v8::internal::CreateSnapshotDataBlobInternal (function_code_handling=v8::SnapshotCreator::FunctionCodeHandling::kClear, 
    embedded_source=0x0, isolate=0x11f378160) at ../deps/v8/src/snapshot/snapshot.cc:652
#13 0x000000011bd4c490 in (anonymous namespace)::CreateSnapshotDataBlob (isolate=0x11f378160, embedded_source=0x0) at ../deps/v8/src/snapshot/mksnapshot.cc:153
#14 0x000000011bd4d500 in main (argc=1, argv=0x3ffffb208548) at ../deps/v8/src/snapshot/mksnapshot.cc:272

@jhamby
Copy link
Owner Author

jhamby commented Nov 3, 2020

Some good news: I have patches to get past this bug. It has to do with 64-bit PowerPC big-endian using function descriptors, like AIX, but unlike 32-bit PPC or ppc64le. I'm working on a pull request to submit upstream, as well as an .ebuild with a patch for building within Gentoo.

But I need to fix one remaining bug (at least): the V8 PowerPC code gen backend generates FP to int rounding instructions that are only available in Power ISA v2.03 and newer CPUs, which doesn't include PowerPC 970. More details here: ibmruntimes/node#30

@jhamby
Copy link
Owner Author

jhamby commented Nov 12, 2020

I figured out how to fix this with a patch, which I need to upstream, so I'll close my local bug now.

@jhamby jhamby closed this as completed Nov 12, 2020
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