node-segfault-handler icon indicating copy to clipboard operation
node-segfault-handler copied to clipboard

Missing "execinfo.h" on Node Alpine

Open soundstep opened this issue 5 years ago • 7 comments

Hi,

I've got an issue running an NPM install with this module in Docker (node-alpine):

FROM node:12.15.0-alpine

The issue:

> [email protected] install /opt/hades/node_modules/segfault-handler
> node-gyp rebuild

make: Entering directory '/opt/hades/node_modules/segfault-handler/build'
  CXX(target) Release/obj.target/segfault-handler/src/segfault-handler.o
../src/segfault-handler.cpp:23:10: fatal error: execinfo.h: No such file or directory
   23 | #include <execinfo.h>
      |          ^~~~~~~~~~~~
compilation terminated.
make: Leaving directory '/opt/hades/node_modules/segfault-handler/build'
make: *** [segfault-handler.target.mk:113: Release/obj.target/segfault-handler/src/segfault-handler.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:223:5)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Linux 4.19.76-linuxkit
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /opt/hades/node_modules/segfault-handler
gyp ERR! node -v v12.15.0
gyp ERR! node-gyp -v v5.0.5

I tried the fix found there: https://github.com/nodejs/node-report/issues/86#issuecomment-300443521

RUN echo "@edge http://nl.alpinelinux.org/alpine/edge/main" >> /etc/apk/repositories
RUN apk update
RUN apk add libexecinfo-dev@edge

I got a lot of red warnings like: warning: cast between incompatible function types from 'void

But the install go through and the docker image is built successfully.

However it is still not working, it seems it doesn't find the backtrace tool when a SIGSEGV signal happens:

/opt/hades/node_modules/bindings/bindings.js:121
        throw e;
        ^

Error: Error relocating /opt/hades/node_modules/segfault-handler/build/Release/segfault-handler.node: backtrace: symbol not found
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:1021:18)
    at Module.load (internal/modules/cjs/loader.js:811:32)
    at Function.Module._load (internal/modules/cjs/loader.js:723:14)
    at Module.require (internal/modules/cjs/loader.js:848:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at bindings (/opt/hades/node_modules/bindings/bindings.js:112:48)
    at Object.<anonymous> (/opt/hades/node_modules/segfault-handler/index.js:3:37)
    at Module._compile (internal/modules/cjs/loader.js:955:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:991:10)
    at Module.load (internal/modules/cjs/loader.js:811:32)

Any clue?

soundstep avatar Apr 30 '20 09:04 soundstep

@ddopson Busy time? :) Let me know if you have any direction I could investigate, I don't know much about gcc.

soundstep avatar May 14 '20 11:05 soundstep

Any update on this issue?

EDIT: I've managed to fix the issue by adding the following content to my Dockerfile:

RUN apk add --no-cache --no-progress --virtual .gyp \
        python \
        make \
        g++ \
        libexecinfo-dev \
        libexecinfo

Now, I'm receiving the following error:

/home/node/app/node_modules/bindings/bindings.js:121
        throw e;
        ^

Error: Error relocating /home/node/app/node_modules/segfault-handler/build/Release/segfault-handler.node: backtrace: symbol not found
    at Object.Module._extensions..node (node:internal/modules/cjs/loader:1142:18)
    at Module.load (node:internal/modules/cjs/loader:948:32)
    at Function.Module._load (node:internal/modules/cjs/loader:789:14)
    at Module.require (node:internal/modules/cjs/loader:972:19)
    at require (node:internal/modules/cjs/helpers:88:18)
    at bindings (/home/node/app/node_modules/bindings/bindings.js:112:48)
    at Object.<anonymous> (/home/node/app/node_modules/segfault-handler/index.js:3:37)
    at Module._compile (node:internal/modules/cjs/loader:1083:30)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1112:10)
    at Module.load (node:internal/modules/cjs/loader:948:32) {
  code: 'ERR_DLOPEN_FAILED'
}

iosifnicolae2 avatar Feb 06 '21 13:02 iosifnicolae2

Sorry, I'm not actively maintaining this module. I'll gladly help you to the degree I'm able (and notice), but I don't even have node-js installed at this point.

If you're passionate about this module, perhaps you'd be interested to become the official maintainer for it?

On Sat, Feb 6, 2021 at 8:46 AM Iosif Nicolae [email protected] wrote:

Any update on this issue?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ddopson/node-segfault-handler/issues/70#issuecomment-774479875, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHJ3X274C7ABPOKKBSCKV3S5VBZ3ANCNFSM4MVLPQPA .

ddopson avatar Feb 09 '21 18:02 ddopson

This fixes it: #76. Could you merge an publish 1.3.1?

LaurentGoderre avatar May 20 '21 13:05 LaurentGoderre

Nevermind, the current unrelease fixed is better.

LaurentGoderre avatar May 20 '21 14:05 LaurentGoderre

Good news: I looked at the "network" page for this repo, and found this fork: https://github.com/node-3d/segfault-raub

I've tried it, and I think it works fine on Node Alpine. (no errors during installation nor pod startup at least; I have not hit a segfault since installing it though, so cannot yet completely confirm it works)

Unfortunately, the fork developer changed the API to remove some of the customization options, such that the segfaults are always written to the standard-error stream, and written to a local segfault.log file (if it already exists).

It's a bit annoying that you can't add a callback hook to customize the log messages, or change the log filename, but it does get the job done.

Venryx avatar Jan 12 '22 00:01 Venryx

If someone wants to take over official maintenance for this package, we can change the docs on my page to refer to the new official version. I don't have the cycles to pay attention to this module.

On Tue, Jan 11, 2022 at 7:09 PM Stephen Wicklund @.***> wrote:

Good news: I looked at the "network" page https://github.com/ddopson/node-segfault-handler/network for this repo, and found this fork: https://github.com/node-3d/segfault-raub

I've tried it, and I think it works fine on Node Alpine. (no errors during installation nor pod startup at least; I have not hit a segfault since installing it though, so cannot completely confirm it works)

Unfortunately, the fork developer changed the API to remove some of the customization options, such that the segfaults are always written to the standard-error stream, and written to a local segfault.log file (if it already exists).

It's a bit annoying that you can't add a callback hook to customize the log messages, or change the log filename, but it does get the job done.

— Reply to this email directly, view it on GitHub https://github.com/ddopson/node-segfault-handler/issues/70#issuecomment-1010492694, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHJ3X2IQK65AASB7UAFBKTUVTBFDANCNFSM4MVLPQPA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you were mentioned.Message ID: @.***>

ddopson avatar Jan 12 '22 20:01 ddopson