nodejs / help

:sparkles: Need help with Node.js? File an Issue here. :rocket:
1.48k stars 284 forks source link

NPM install returning Segmentation fault on PPC64 architecture #2900

Closed narkhedek3 closed 3 years ago

narkhedek3 commented 4 years ago

Not able to create the new angular project because npm install returning segmentation fault(core dumped).

$ ng new my-app
? Would you like to add Angular routing? Yes
? Which stylesheet format would you like to use? CSS
CREATE my-app/README.md (1023 bytes)
CREATE my-app/.editorconfig (274 bytes)
CREATE my-app/.gitignore (631 bytes)
CREATE my-app/angular.json (3566 bytes)
CREATE my-app/package.json (1249 bytes)
CREATE my-app/tsconfig.base.json (458 bytes)
CREATE my-app/tsconfig.json (426 bytes)
CREATE my-app/tslint.json (3184 bytes)
CREATE my-app/.browserslistrc (853 bytes)
CREATE my-app/karma.conf.js (1018 bytes)
CREATE my-app/tsconfig.app.json (292 bytes)
CREATE my-app/tsconfig.spec.json (338 bytes)
CREATE my-app/src/favicon.ico (948 bytes)
CREATE my-app/src/index.html (291 bytes)
CREATE my-app/src/main.ts (372 bytes)
CREATE my-app/src/polyfills.ts (2835 bytes)
CREATE my-app/src/styles.css (80 bytes)
CREATE my-app/src/test.ts (753 bytes)
CREATE my-app/src/assets/.gitkeep (0 bytes)
CREATE my-app/src/environments/environment.prod.ts (51 bytes)
CREATE my-app/src/environments/environment.ts (662 bytes)
CREATE my-app/src/app/app-routing.module.ts (245 bytes)
CREATE my-app/src/app/app.module.ts (393 bytes)
CREATE my-app/src/app/app.component.css (0 bytes)
CREATE my-app/src/app/app.component.html (25757 bytes)
CREATE my-app/src/app/app.component.spec.ts (1059 bytes)
CREATE my-app/src/app/app.component.ts (210 bytes)
CREATE my-app/e2e/protractor.conf.js (869 bytes)
CREATE my-app/e2e/tsconfig.json (299 bytes)
CREATE my-app/e2e/src/app.e2e-spec.ts (639 bytes)
CREATE my-app/e2e/src/app.po.ts (301 bytes)
⠧ Installing packages...Segmentation fault (core dumped)
bnoordhuis commented 4 years ago

cc @nodejs/platform-aix (I know, it's not AIX but we don't have a PPC team.)

@narkhedek3 Would it be possible for you turn on core dumps (ulimit -c unlimited) and inspect the core dump with gdb afterwards?

gdb $(which node) <corefile> , then bt to get a stack trace and disassemble and info registers to get a disassembly of the segfaulting code.

shellberg commented 4 years ago

Based on the output of a fairly recent Angular 'ng' issue (illustrative of the steps the ng tool is trying to take), it looks like your problem might be experienced with the 'npm' binary?

Can you see if your SIGSEGV is reproducible with something as simple as 'npm -v'?

miladfarca commented 4 years ago

Cannot reproduce the issue.

Compiled from source:

git clone https://github.com/nodejs/node.git
git checkout v12.18.3

Used binaries from the community:

wget https://nodejs.org/dist/v12.18.3/node-v12.18.3-linux-ppc64le.tar.gz

npm version is 6.14.6. Also tried 6.14.7 by upgrading with npm install -g npm@6.14.7

Environment on docker:

# cat /etc/*release
CentOS Linux release 7.8.2003 (AltArch)
NAME="CentOS Linux"
VERSION="7 (AltArch)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"

# lscpu
Architecture:          ppc64le

Output:

# ng new my-app
? Would you like to add Angular routing? Yes
? Which stylesheet format would you like to use? CSS
CREATE my-app/README.md (1023 bytes)
CREATE my-app/.editorconfig (274 bytes)
CREATE my-app/.gitignore (631 bytes)
CREATE my-app/angular.json (3566 bytes)
CREATE my-app/package.json (1249 bytes)
CREATE my-app/tsconfig.base.json (458 bytes)
CREATE my-app/tsconfig.json (426 bytes)
CREATE my-app/tslint.json (3184 bytes)
CREATE my-app/.browserslistrc (853 bytes)
CREATE my-app/karma.conf.js (1018 bytes)
CREATE my-app/tsconfig.app.json (292 bytes)
CREATE my-app/tsconfig.spec.json (338 bytes)
CREATE my-app/src/favicon.ico (948 bytes)
CREATE my-app/src/index.html (291 bytes)
CREATE my-app/src/main.ts (372 bytes)
CREATE my-app/src/polyfills.ts (2835 bytes)
CREATE my-app/src/styles.css (80 bytes)
CREATE my-app/src/test.ts (753 bytes)
CREATE my-app/src/assets/.gitkeep (0 bytes)
CREATE my-app/src/environments/environment.prod.ts (51 bytes)
CREATE my-app/src/environments/environment.ts (662 bytes)
CREATE my-app/src/app/app-routing.module.ts (245 bytes)
CREATE my-app/src/app/app.module.ts (393 bytes)
CREATE my-app/src/app/app.component.css (0 bytes)
CREATE my-app/src/app/app.component.html (25757 bytes)
CREATE my-app/src/app/app.component.spec.ts (1059 bytes)
CREATE my-app/src/app/app.component.ts (210 bytes)
CREATE my-app/e2e/protractor.conf.js (869 bytes)
CREATE my-app/e2e/tsconfig.json (299 bytes)
CREATE my-app/e2e/src/app.e2e-spec.ts (639 bytes)
CREATE my-app/e2e/src/app.po.ts (301 bytes)
✔ Packages installed successfully.

This isn't a Big endian machine correct?

narkhedek3 commented 4 years ago

Thank you for your responses, When I am using following tar file it is giving error https://nodejs.org/dist/latest-v12.x/node-v12.18.3-linux-ppc64le.tar.gz But after installing using following tar file issue is resolved https://nodejs.org/dist/latest-v12.x/node-v12.18.3.tar.gz

miladfarca commented 4 years ago

I also tried your first link within my Centos docker env and it's working fine.

Your second link is the src code, did you compile from src?

narkhedek3 commented 4 years ago

@miladfarca

Your second link is the src code, did you compile from src?

Yes I have compiled src code

miladfarca commented 4 years ago

Could you please share your exact Centos version with cat /etc/*release. Having the core dump data will also help a lot: https://github.com/nodejs/help/issues/2900#issuecomment-671268522

narkhedek3 commented 4 years ago

@miladfarca

$ cat /etc/*release
CentOS Linux release 7.7.1908 (AltArch)
NAME="CentOS Linux"
VERSION="7 (AltArch)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (AltArch)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7:server"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"

CentOS Linux release 7.7.1908 (AltArch)
CentOS Linux release 7.7.1908 (AltArch)
miladfarca commented 4 years ago

There are no PPC docker images for Centos 7.7.1908 so I tried 7.6.1810 (as well as 7.8.2003) and they both work just fine. We will need your core dump data to look into the issue, you can upload it here and we can try analyzing it in our env or you can follow https://github.com/nodejs/help/issues/2900#issuecomment-671268522 and copy the data here.

You might have a specific libc (or another dependent library) installed locally which is causing our binaries to crash (and works fine when you compile it yourself).

narkhedek3 commented 4 years ago

@miladfarca,

Program received signal SIGSEGV, Segmentation fault.
0x000578e000020000 in ?? ()
Missing separate debuginfos, use: debuginfo-install glibc-2.17-292.el7.ppc64le libgcc-4.8.5-39.el7.ppc64le libstdc++-4.8.5-39.el7.ppc64le
(gdb) bt
#0  0x000578e000020000 in ?? ()
#1  0x0000000010649154 in uv__hrtime (type=UV_CLOCK_FAST) at ../deps/uv/src/unix/linux-core.c:431
#2  uv__update_time (loop=0x11e4c310 <default_loop_struct>) at ../deps/uv/src/unix/internal.h:311
#3  uv__io_poll (loop=0x11e4c310 <default_loop_struct>, timeout=<optimized out>)
    at ../deps/uv/src/unix/linux-core.c:285
#4  0x0000000010631c74 in uv_run (loop=0x11e4c310 <default_loop_struct>, mode=<optimized out>)
    at ../deps/uv/src/unix/core.c:370
#5  0x00000000104ff8b0 in node::Start(uv_loop_s*, int, char const* const*, int, char const* const*) ()
#6  0x00000000104fe50c in node::Start(int, char**) ()
#7  0x00000000104bb798 in main ()
(gdb) disassemble uv__hrtime
Dump of assembler code for function uv__hrtime:
   0x00000000106495b0 <+0>:     lis     r2,4581
   0x00000000106495b4 <+4>:     addi    r2,r2,-6248
   0x00000000106495b8 <+8>:     mflr    r0
   0x00000000106495bc <+12>:    std     r30,-16(r1)
   0x00000000106495c0 <+16>:    std     r31,-8(r1)
   0x00000000106495c4 <+20>:    cmpwi   cr7,r3,1
   0x00000000106495c8 <+24>:    std     r29,-24(r1)
   0x00000000106495cc <+28>:    ld      r30,-31960(r2)
   0x00000000106495d0 <+32>:    li      r3,1
   0x00000000106495d4 <+36>:    std     r0,16(r1)
   0x00000000106495d8 <+40>:    stdu    r1,-80(r1)
   0x00000000106495dc <+44>:    mr      r31,r1
   0x00000000106495e0 <+48>:    beq     cr7,0x10649640 <uv__hrtime+144>
   0x00000000106495e4 <+52>:    addi    r4,r31,32
   0x00000000106495e8 <+56>:    bl      0x10429e90 <0000022e.plt_call.clock_gettime@@GLIBC_2.17>
   0x00000000106495ec <+60>:    ld      r2,24(r1)
   0x00000000106495f0 <+64>:    li      r9,0
   0x00000000106495f4 <+68>:    cmpdi   cr7,r3,0
   0x00000000106495f8 <+72>:    bne     cr7,0x10649614 <uv__hrtime+100>
   0x00000000106495fc <+76>:    ld      r10,32(r31)
   0x0000000010649600 <+80>:    lis     r9,15258
   0x0000000010649604 <+84>:    ori     r9,r9,51712
   0x0000000010649608 <+88>:    mulld   r9,r9,r10
   0x000000001064960c <+92>:    ld      r10,40(r31)
---Type <return> to continue, or q <return> to quit---
   0x0000000010649610 <+96>:    add     r9,r9,r10
   0x0000000010649614 <+100>:   addi    r1,r31,80
   0x0000000010649618 <+104>:   mr      r3,r9
   0x000000001064961c <+108>:   ld      r0,16(r1)
   0x0000000010649620 <+112>:   ld      r29,-24(r1)
   0x0000000010649624 <+116>:   ld      r30,-16(r1)
   0x0000000010649628 <+120>:   ld      r31,-8(r1)
   0x000000001064962c <+124>:   mtlr    r0
   0x0000000010649630 <+128>:   blr
   0x0000000010649634 <+132>:   nop
   0x0000000010649638 <+136>:   nop
   0x000000001064963c <+140>:   ori     r2,r2,0
   0x0000000010649640 <+144>:   ld      r29,-32624(r30)
   0x0000000010649644 <+148>:   ld      r3,0(r29)
   0x0000000010649648 <+152>:   cmpdi   cr7,r3,-1
   0x000000001064964c <+156>:   extsw   r3,r3
   0x0000000010649650 <+160>:   bne     cr7,0x106495e4 <uv__hrtime+52>
   0x0000000010649654 <+164>:   li      r3,6
   0x0000000010649658 <+168>:   addi    r4,r31,32
   0x000000001064965c <+172>:   bl      0x10429200 <0000022e.plt_call.clock_getres@@GLIBC_2.17>
   0x0000000010649660 <+176>:   ld      r2,24(r1)
   0x0000000010649664 <+180>:   cmpdi   cr7,r3,0
   0x0000000010649668 <+184>:   bne     cr7,0x10649690 <uv__hrtime+224>
   0x000000001064966c <+188>:   ld      r10,40(r31)
   0x0000000010649670 <+192>:   lis     r9,15
---Type <return> to continue, or q <return> to quit---
   0x0000000010649674 <+196>:   ori     r9,r9,16960
   0x0000000010649678 <+200>:   cmpd    cr7,r10,r9
   0x000000001064967c <+204>:   bgt     cr7,0x10649690 <uv__hrtime+224>
   0x0000000010649680 <+208>:   li      r9,6
   0x0000000010649684 <+212>:   li      r3,6
   0x0000000010649688 <+216>:   std     r9,0(r29)
   0x000000001064968c <+220>:   b       0x106495e4 <uv__hrtime+52>
   0x0000000010649690 <+224>:   li      r9,1
   0x0000000010649694 <+228>:   li      r3,1
   0x0000000010649698 <+232>:   std     r9,0(r29)
   0x000000001064969c <+236>:   b       0x106495e4 <uv__hrtime+52>
   0x00000000106496a0 <+240>:   .long 0x0
   0x00000000106496a4 <+244>:   .long 0x1000000
   0x00000000106496a8 <+248>:   .long 0x380
End of assembler dump.
(gdb) info register
r0             0x10649088       275026056
r1             0x7fffffff9ab0   140737488329392
r2             0x11e4e798       300214168
r3             0x6      6
r4             0x7fffffff9af0   140737488329456
r5             0x0      0
r6             0xffffffffffffffff       18446744073709551615
r7             0x0      0
r8             0x2      2
r9             0x0      0
r10            0x0      0
r11            0x0      0
r12            0x578e000020000  1540278351691776
r13            0x7ffff7ffcc50   140737354124368
r14            0x11e4c310       300204816
r15            0x0      0
r16            0x0      0
r17            0x0      0
r18            0x3e4fac2a1      16726540961
r19            0x3b9aca00       1000000000
r20            0x0      0
r21            0x11df08b0       299829424
r22            0xffffffffffffffff       18446744073709551615
r23            0x431bde82d7b634db       4835703278458516699
r24            0x7fffffff9b80   140737488329600
---Type <return> to continue, or q <return> to quit---
r25            0x7ffff7ff5c90   140737354095760
r26            0x0      0
r27            0x1      1
r28            0xffffffffffffffff       18446744073709551615
r29            0x11e4c540       300205376
r30            0x11e192b0       299995824
r31            0x7fffffff9ab0   140737488329392
pc             0x578e000020000  0x578e000020000
msr            0x900000004000d033       10376293542535417907
cr             0x24002882       603990146
lr             0x10649154       0x10649154 <uv__io_poll+692>
ctr            0x578e000020000  1540278351691776
xer            0x0      0
orig_r3        0x1042920c       272798220
trap           0x400    1024
miladfarca commented 4 years ago

Is gdb using the same node binary which caused the segfault? Assuming this: https://nodejs.org/dist/latest-v12.x/node-v12.18.3-linux-ppc64le.tar.gz

0x10649154 isn't part of uv__hrtime in your disassembled code. Also uv__hrtime is around the line 486 for me given the same node version:

(gdb) b uv__hrtime
(gdb) r
(gdb) bt
#0  uv__hrtime (type=UV_CLOCK_PRECISE) at ../deps/uv/src/unix/linux-core.c:486

Does running node --version work?

narkhedek3 commented 4 years ago

@miladfarca, Sorry for the inconvenience caused. I have provided node-v8.17.0 backtrace by mistake. Backtrace with node-v12.18.3 while creating the new angular app is as follows:

Reading symbols from /home/parade/node-v12.18.3-linux-ppc64le/bin/node...done.
[New LWP 137446]
[New LWP 137450]
[New LWP 137448]
[New LWP 137451]
[New LWP 137447]
[New LWP 137452]
[New LWP 137449]
Core was generated by `ng new my-app                                   '.
Program terminated with signal 11, Segmentation fault.
#0  0x0000000000000000 in ?? ()
(gdb) bt
#0  0x0000000000000000 in ?? ()
#1  0x0000000011275ad8 in uv__signal_handler (signum=17) at ../deps/uv/src/unix/signal.c:186
#2  <signal handler called>
#3  0x00007fffb29b8a28 in ?? ()
#4  0x00007fffb29b89f0 in ?? ()
#5  0x00000000112821b8 in uv__io_poll (loop=0x128b72b0 <default_loop_struct>, timeout=<optimized out>)
    at ../deps/uv/src/unix/linux-core.c:309
#6  0x00000000112685c0 in uv_run (loop=0x128b72b0 <default_loop_struct>, mode=<optimized out>)
    at ../deps/uv/src/unix/core.c:381
#7  0x000000001069e330 in node::NodeMainInstance::Run() ()
#8  0x000000001060f784 in node::Start(int, char**) ()
#9  0x000000001058a858 in main ()
(gdb) disassemble  uv__signal_handler
Dump of assembler code for function uv__signal_handler:
   0x0000000011275a90 <+0>:     lis     r2,4746
   0x0000000011275a94 <+4>:     addi    r2,r2,19456
   0x0000000011275a98 <+8>:     mflr    r0
   0x0000000011275a9c <+12>:    std     r23,-72(r1)
   0x0000000011275aa0 <+16>:    std     r25,-56(r1)
   0x0000000011275aa4 <+20>:    mr      r25,r3
   0x0000000011275aa8 <+24>:    std     r26,-48(r1)
   0x0000000011275aac <+28>:    std     r27,-40(r1)
   0x0000000011275ab0 <+32>:    std     r28,-32(r1)
   0x0000000011275ab4 <+36>:    std     r30,-16(r1)
   0x0000000011275ab8 <+40>:    std     r31,-8(r1)
   0x0000000011275abc <+44>:    std     r24,-64(r1)
   0x0000000011275ac0 <+48>:    std     r29,-24(r1)
   0x0000000011275ac4 <+52>:    ld      r30,-28176(r2)
   0x0000000011275ac8 <+56>:    std     r0,16(r1)
   0x0000000011275acc <+60>:    stdu    r1,-288(r1)
   0x0000000011275ad0 <+64>:    mr      r31,r1
   0x0000000011275ad4 <+68>:    bl      0x10564134 <0000082a.plt_call.__errno_location@@GLIBC_2.17>
   0x0000000011275ad8 <+72>:    ld      r2,24(r1)
   0x0000000011275adc <+76>:    li      r9,0
   0x0000000011275ae0 <+80>:    ld      r26,-32768(r30)
   0x0000000011275ae4 <+84>:    addi    r27,r31,32
   0x0000000011275ae8 <+88>:    lwa     r23,0(r3)
   0x0000000011275aec <+92>:    mr      r28,r3
---Type <return> to continue, or q <return> to quit---
   0x0000000011275af0 <+96>:    std     r9,184(r31)
   0x0000000011275af4 <+100>:   std     r9,192(r31)
   0x0000000011275af8 <+104>:   b       0x11275b0c <uv__signal_handler+124>
   0x0000000011275afc <+108>:   ori     r2,r2,0
   0x0000000011275b00 <+112>:   lwz     r9,0(r28)
   0x0000000011275b04 <+116>:   cmpwi   cr7,r9,4
   0x0000000011275b08 <+120>:   bne     cr7,0x11275c68 <uv__signal_handler+472>
   0x0000000011275b0c <+124>:   lwa     r3,0(r26)
   0x0000000011275b10 <+128>:   li      r5,1
   0x0000000011275b14 <+132>:   mr      r4,r27
   0x0000000011275b18 <+136>:   bl      0x105643b4 <0000082a.plt_call.read@@GLIBC_2.17>
   0x0000000011275b1c <+140>:   ld      r2,24(r1)
   0x0000000011275b20 <+144>:   cmpwi   cr7,r3,0
   0x0000000011275b24 <+148>:   blt     cr7,0x11275b00 <uv__signal_handler+112>
   0x0000000011275b28 <+152>:   ld      r9,-32736(r30)
   0x0000000011275b2c <+156>:   stw     r25,136(r31)
   0x0000000011275b30 <+160>:   li      r10,0
   0x0000000011275b34 <+164>:   ld      r29,0(r9)
   0x0000000011275b38 <+168>:   li      r9,0
   0x0000000011275b3c <+172>:   stw     r9,120(r31)
   0x0000000011275b40 <+176>:   li      r9,0
   0x0000000011275b44 <+180>:   cmpdi   cr5,r29,0
   0x0000000011275b48 <+184>:   std     r9,40(r31)
   0x0000000011275b4c <+188>:   beq     cr5,0x11275c2c <uv__signal_handler+412>
   0x0000000011275b50 <+192>:   lwa     r9,104(r29)
---Type <return> to continue, or q <return> to quit---
   0x0000000011275b54 <+196>:   cmpw    cr7,r25,r9
   0x0000000011275b58 <+200>:   blt     cr7,0x11275ca0 <uv__signal_handler+528>
   0x0000000011275b5c <+204>:   bgt     cr7,0x11275b84 <uv__signal_handler+244>
   0x0000000011275b60 <+208>:   lwz     r9,88(r29)
   0x0000000011275b64 <+212>:   andis.  r8,r9,512
   0x0000000011275b68 <+216>:   bne     0x11275ca0 <uv__signal_handler+528>
   0x0000000011275b6c <+220>:   ld      r9,8(r29)
   0x0000000011275b70 <+224>:   cmpdi   cr6,r9,0
   0x0000000011275b74 <+228>:   bne     cr6,0x11275ca0 <uv__signal_handler+528>
   0x0000000011275b78 <+232>:   cmpld   cr6,r27,r29
   0x0000000011275b7c <+236>:   blt     cr6,0x11275ca0 <uv__signal_handler+528>
   0x0000000011275b80 <+240>:   ble     cr6,0x11275d24 <uv__signal_handler+660>
   0x0000000011275b84 <+244>:   ld      r29,120(r29)
   0x0000000011275b88 <+248>:   cmpdi   cr5,r29,0
   0x0000000011275b8c <+252>:   bne     cr5,0x11275b50 <uv__signal_handler+192>
   0x0000000011275b90 <+256>:   cmpdi   cr7,r10,0
   0x0000000011275b94 <+260>:   beq     cr7,0x11275c2c <uv__signal_handler+412>
   0x0000000011275b98 <+264>:   lwz     r9,104(r10)
   0x0000000011275b9c <+268>:   mr      r29,r10
   0x0000000011275ba0 <+272>:   cmpw    cr7,r9,r25
   0x0000000011275ba4 <+276>:   bne     cr7,0x11275c2c <uv__signal_handler+412>
   0x0000000011275ba8 <+280>:   mr      r24,r25
   0x0000000011275bac <+284>:   ori     r2,r2,0
   0x0000000011275bb0 <+288>:   stw     r24,192(r31)
   0x0000000011275bb4 <+292>:   std     r29,184(r31)
---Type <return> to continue, or q <return> to quit---
   0x0000000011275bb8 <+296>:   b       0x11275bcc <uv__signal_handler+316>
   0x0000000011275bbc <+300>:   ori     r2,r2,0
   0x0000000011275bc0 <+304>:   lwa     r9,0(r28)
   0x0000000011275bc4 <+308>:   cmpwi   cr7,r9,4
   0x0000000011275bc8 <+312>:   bne     cr7,0x11275cb0 <uv__signal_handler+544>
   0x0000000011275bcc <+316>:   ld      r9,8(r29)
   0x0000000011275bd0 <+320>:   li      r5,16
   0x0000000011275bd4 <+324>:   addi    r4,r31,184
   0x0000000011275bd8 <+328>:   lwa     r3,556(r9)
   0x0000000011275bdc <+332>:   bl      0x10563d60 <0000082a.plt_call.write@@GLIBC_2.17>
   0x0000000011275be0 <+336>:   ld      r2,24(r1)
   0x0000000011275be4 <+340>:   extsw   r3,r3
   0x0000000011275be8 <+344>:   cmpwi   cr7,r3,-1
   0x0000000011275bec <+348>:   beq     cr7,0x11275bc0 <uv__signal_handler+304>
   0x0000000011275bf0 <+352>:   cmpwi   cr7,r3,16
   0x0000000011275bf4 <+356>:   bne     cr7,0x11275cb8 <uv__signal_handler+552>
   0x0000000011275bf8 <+360>:   lwz     r9,144(r29)
   0x0000000011275bfc <+364>:   addi    r9,r9,1
   0x0000000011275c00 <+368>:   stw     r9,144(r29)
   0x0000000011275c04 <+372>:   ld      r9,120(r29)
   0x0000000011275c08 <+376>:   cmpdi   cr7,r9,0
   0x0000000011275c0c <+380>:   beq     cr7,0x11275cd0 <uv__signal_handler+576>
   0x0000000011275c10 <+384>:   mr      r29,r9
   0x0000000011275c14 <+388>:   ld      r9,112(r9)
   0x0000000011275c18 <+392>:   cmpdi   cr7,r9,0
---Type <return> to continue, or q <return> to quit---
   0x0000000011275c1c <+396>:   bne     cr7,0x11275c10 <uv__signal_handler+384>
   0x0000000011275c20 <+400>:   lwz     r9,104(r29)
   0x0000000011275c24 <+404>:   cmpw    cr7,r9,r25
   0x0000000011275c28 <+408>:   beq     cr7,0x11275bb0 <uv__signal_handler+288>
   0x0000000011275c2c <+412>:   li      r9,42
   0x0000000011275c30 <+416>:   stb     r9,32(r31)
   0x0000000011275c34 <+420>:   b       0x11275c4c <uv__signal_handler+444>
   0x0000000011275c38 <+424>:   nop
   0x0000000011275c3c <+428>:   ori     r2,r2,0
   0x0000000011275c40 <+432>:   lwz     r9,0(r28)
   0x0000000011275c44 <+436>:   cmpwi   cr7,r9,4
   0x0000000011275c48 <+440>:   bne     cr7,0x11275c68 <uv__signal_handler+472>
   0x0000000011275c4c <+444>:   lwa     r3,4(r26)
   0x0000000011275c50 <+448>:   li      r5,1
   0x0000000011275c54 <+452>:   mr      r4,r27
   0x0000000011275c58 <+456>:   bl      0x10563d60 <0000082a.plt_call.write@@GLIBC_2.17>
   0x0000000011275c5c <+460>:   ld      r2,24(r1)
   0x0000000011275c60 <+464>:   cmpwi   cr7,r3,0
   0x0000000011275c64 <+468>:   blt     cr7,0x11275c40 <uv__signal_handler+432>
   0x0000000011275c68 <+472>:   addi    r1,r31,288
   0x0000000011275c6c <+476>:   stw     r23,0(r28)
   0x0000000011275c70 <+480>:   ld      r0,16(r1)
   0x0000000011275c74 <+484>:   ld      r23,-72(r1)
   0x0000000011275c78 <+488>:   ld      r24,-64(r1)
   0x0000000011275c7c <+492>:   ld      r25,-56(r1)
---Type <return> to continue, or q <return> to quit---
   0x0000000011275c80 <+496>:   ld      r26,-48(r1)
   0x0000000011275c84 <+500>:   ld      r27,-40(r1)
   0x0000000011275c88 <+504>:   ld      r28,-32(r1)
   0x0000000011275c8c <+508>:   ld      r29,-24(r1)
   0x0000000011275c90 <+512>:   ld      r30,-16(r1)
   0x0000000011275c94 <+516>:   ld      r31,-8(r1)
   0x0000000011275c98 <+520>:   mtlr    r0
   0x0000000011275c9c <+524>:   blr
   0x0000000011275ca0 <+528>:   mr      r10,r29
   0x0000000011275ca4 <+532>:   ld      r29,112(r29)
   0x0000000011275ca8 <+536>:   b       0x11275b88 <uv__signal_handler+248>
   0x0000000011275cac <+540>:   ori     r2,r2,0
   0x0000000011275cb0 <+544>:   cmpwi   cr7,r9,11
   0x0000000011275cb4 <+548>:   beq     cr7,0x11275c04 <uv__signal_handler+372>
   0x0000000011275cb8 <+552>:   ld      r6,-32760(r30)
   0x0000000011275cbc <+556>:   ld      r4,-32752(r30)
   0x0000000011275cc0 <+560>:   ld      r3,-32744(r30)
   0x0000000011275cc4 <+564>:   li      r5,211
   0x0000000011275cc8 <+568>:   bl      0x10563d24 <0000082a.plt_call.__assert_fail@@GLIBC_2.17>
   0x0000000011275ccc <+572>:   ld      r2,24(r1)
   0x0000000011275cd0 <+576>:   ld      r9,128(r29)
   0x0000000011275cd4 <+580>:   cmpdi   cr7,r9,0
   0x0000000011275cd8 <+584>:   beq     cr7,0x11275c2c <uv__signal_handler+412>
   0x0000000011275cdc <+588>:   ld      r10,112(r9)
   0x0000000011275ce0 <+592>:   cmpd    cr7,r10,r29
---Type <return> to continue, or q <return> to quit---
   0x0000000011275ce4 <+596>:   bne     cr7,0x11275d04 <uv__signal_handler+628>
   0x0000000011275ce8 <+600>:   b       0x11275d10 <uv__signal_handler+640>
   0x0000000011275cec <+604>:   ori     r2,r2,0
   0x0000000011275cf0 <+608>:   ld      r10,128(r9)
   0x0000000011275cf4 <+612>:   mr      r29,r9
   0x0000000011275cf8 <+616>:   cmpdi   cr7,r10,0
   0x0000000011275cfc <+620>:   beq     cr7,0x11275c2c <uv__signal_handler+412>
   0x0000000011275d00 <+624>:   mr      r9,r10
   0x0000000011275d04 <+628>:   ld      r10,120(r9)
   0x0000000011275d08 <+632>:   cmpd    cr7,r10,r29
   0x0000000011275d0c <+636>:   beq     cr7,0x11275cf0 <uv__signal_handler+608>
   0x0000000011275d10 <+640>:   mr      r29,r9
   0x0000000011275d14 <+644>:   lwz     r9,104(r29)
   0x0000000011275d18 <+648>:   cmpw    cr7,r9,r25
   0x0000000011275d1c <+652>:   beq     cr7,0x11275bb0 <uv__signal_handler+288>
   0x0000000011275d20 <+656>:   b       0x11275c2c <uv__signal_handler+412>
   0x0000000011275d24 <+660>:   bne     cr7,0x11275c2c <uv__signal_handler+412>
   0x0000000011275d28 <+664>:   bne     cr5,0x11275ba8 <uv__signal_handler+280>
   0x0000000011275d2c <+668>:   b       0x11275c2c <uv__signal_handler+412>
   0x0000000011275d30 <+672>:   .long 0x0
   0x0000000011275d34 <+676>:   .long 0x1000000
   0x0000000011275d38 <+680>:   .long 0x980
End of assembler dump.
(gdb)
(gdb) info register
r0             0x7fffb2dd04d8   140736194217176
r1             0x7fffed49f0d0   140737174434000
r2             0x128a4c00       311053312
r3             0x11     17
r4             0x7fffed49f318   140737174434584
r5             0x400    1024
r6             0xffffffffffffffff       18446744073709551615
r7             0x2      2
r8             0x0      0
r9             0x0      0
r10            0x0      0
r11            0x0      0
r12            0x0      0
r13            0x7fffb2e3ca40   140736194660928
r14            0x0      0
r15            0x0      0
r16            0x1      1
r17            0x30     48
r18            0x3b9aca00       1000000000
r19            0x3eedb5ef8      16892255992
r20            0xffffffffffffffff       18446744073709551615
r21            0x431bde82d7b634db       4835703278458516699
r22            0x7fffed4a02f0   140737174438640
r23            0x128b76e4       311129828
r24            0x128b7308       311128840
---Type <return> to continue, or q <return> to quit---
r25            0x11     17
r26            0xffffffffffffffff       18446744073709551615
r27            0x128b72b0       311128752
r28            0x128b72b0       311128752
r29            0x128b7308       311128840
r30            0x12887728       310933288
r31            0x7fffed49f0d0   140737174434000
pc             0x0      0x0
msr            0x900000004280f033       10376293542577369139
cr             0x54002888       1409296520
lr             0x11275ad8       0x11275ad8 <uv__signal_handler+72>
ctr            0x0      0
xer            0x0      0
orig_r3        0x10564144       274088260
trap           0x400    1024
bnoordhuis commented 4 years ago

#1 0x0000000011275ad8 in uv__signal_handler (signum=17) at ../deps/uv/src/unix/signal.c:186

FTR, signum=17 is SIGCHLD. What seems to happen is this:

  1. Libuv receives a SIGCHLD signal (expected, okay)

  2. Libuv's signal handler tries to store the thread-local errno variable to avoid clobbering it

  3. glibc's errno PLT stub somehow jumps to address 0x0

This is the offending call (__errno_location() is a wrapper around errno):

   0x0000000011275ad4 <+68>:    bl      0x10564134 <0000082a.plt_call.__errno_location@@GLIBC_2.17>

And that jumps to:

#0  0x0000000000000000 in ?? ()

The PLT is a kind of dynamic jump table. My guess is that this is an async-signal-safety issue in glibc's dynamic linker, i.e., probably not our bug.

Maybe you can work around it by forcing ld.so to resolve all symbols eagerly:

$ env LD_BIND_NOW=1 ng new my-app

It's essential that ng passes on environment variables to child processes in order for that to work however.

PoojaDurgad commented 4 years ago

@narkhedek3 - is this still outstanding??

PoojaDurgad commented 3 years ago

inactive. closing. feel free to reopen the issue if its still outstanding