question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

segfault with grpc@1.7.1 on alpine-3.6

See original GitHub issue

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

> grpc@1.7.1 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.

+ grpc@1.7.1
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

> grpc@1.7.1 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.

+ grpc@1.7.1
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)

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
murgatroid99commented, Dec 4, 2017

We have published the prerelease package grpc@1.8.0-pre2. That includes binaries for alpine, so hopefully this is fixed now. If you could try those out, that would be helpful.

0reactions
thedoddcommented, Dec 6, 2017

1.8.0-pre2 seems to do the trick. Testing now to see if it resolves the client load balancing issues from the 1.6 line and the memory leak issues from the versions before that.

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found