Skip to content

segfault with [email protected] on alpine-3.6 #81

@bkw

Description

@bkw

Using the prebuild binary of grpc-1.7.1 in alpine-3.6 (or rather: in the current node:8-alpine docker build which builds upon alpine-3.6) segfaults when requiring the module:

% docker run -ti --rm node:8-alpine ash
/ # apk add --update libc6-compat
fetch http://dl-cdn.alpinelinux.org/alpine/v3.6/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.6/community/x86_64/APKINDEX.tar.gz
(1/1) Installing libc6-compat (1.1.16-r14)
OK: 5 MiB in 14 packages
/ # npm install grpc

> [email protected] install /node_modules/grpc
> node-pre-gyp install --fallback-to-build --library=static_library

[grpc] Success: "/node_modules/grpc/src/node/extension_binary/node-v57-linux-x64/grpc_node.node" is installed via remote
npm WARN saveError ENOENT: no such file or directory, open '/package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open '/package.json'
npm WARN !invalid#1 No description
npm WARN !invalid#1 No repository field.
npm WARN !invalid#1 No README data
npm WARN !invalid#1 No license field.

+ [email protected]
added 150 packages in 13.427s
/ # node node_modules/grpc/index.js
Segmentation fault

Forcing a build from source makes the segfault go away:

docker run -ti --rm node:8-alpine ash
/ # apk add --update libc6-compat python make gcc musl-dev g++
/ # npm install grpc --build-from-source

> [email protected] install /node_modules/grpc
> node-pre-gyp install --fallback-to-build --library=static_library

206 MiB in 38 packages
make: Entering directory '/node_modules/grpc/build'
  CC(target) Release/obj.target/grpc/deps/grpc/src/core/lib/surface/init.o
  CC(target) Release/obj.target/grpc/deps/grpc/src/core/lib/channel/channel_args.o
[…]
  SOLINK_MODULE(target) Release/obj.target/grpc_node.node
  COPY Release/grpc_node.node
  COPY /node_modules/grpc/src/node/extension_binary/node-v57-linux-x64/grpc_node.node
  TOUCH Release/obj.target/action_after_build.stamp
make: Leaving directory '/node_modules/grpc/build'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN !invalid#1 No description
npm WARN !invalid#1 No repository field.
npm WARN !invalid#1 No license field.

+ [email protected]
added 150 packages in 53.43s
/ # node node_modules/grpc/index.js
/ #

coredump:

Reading symbols from /usr/local/bin/node...done.
[New LWP 42]
[New LWP 47]
[New LWP 46]
[New LWP 45]
[New LWP 44]
[New LWP 43]

warning: Can't read pathname for load map: No error information.
Core was generated by `node node_modules/grpc/index.js'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x0000000000037a56 in ?? ()
[Current thread is 1 (LWP 42)]
(gdb) bt
#0  0x0000000000037a56 in ?? ()
#1  0x00007f2cc97e6e74 in vasprintf (__ap=0x7ffe134552f8,
    __fmt=0x7f2cc98024c0 "Warning: insecure environment read function '%s' used", __ptr=0x7ffe134552f0)
    at /usr/include/x86_64-linux-gnu/bits/stdio2.h:210
#2  gpr_log (file=file@entry=0x7f2cc9802580 "../deps/grpc/src/core/lib/support/log.c", line=line@entry=87,
    severity=severity@entry=GPR_LOG_SEVERITY_DEBUG,
    format=format@entry=0x7f2cc98024c0 "Warning: insecure environment read function '%s' used")
    at ../deps/grpc/src/core/lib/support/log_linux.c:49
#3  0x00007f2cc97e6d52 in gpr_log_verbosity_init () at ../deps/grpc/src/core/lib/support/log.c:87
#4  0x00007f2cc97655db in do_basic_init () at ../deps/grpc/src/core/lib/surface/init.c:67
#5  0x00007f2ccbfef86f in __pthread_once_full () from /lib/ld-musl-x86_64.so.1
#6  0x00007ffe00100200 in ?? ()
#7  0x00007f2ccbfef7ee in pthread_mutexattr_settype () from /lib/ld-musl-x86_64.so.1
#8  0x00007f2cc9a29568 in g_init_mu ()
   from /node_modules/grpc/src/node/extension_binary/node-v57-linux-x64/grpc_node.node
#9  0x0000000000000000 in ?? ()
(gdb)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions