Yelp / dumb-init

A minimal init system for Linux containers
https://engineeringblog.yelp.com/2016/01/dumb-init-an-init-for-docker.html
MIT License
6.89k stars 345 forks source link

`dumb-init` swallows SegFault error logs from NodeJS #291

Closed tchupp closed 1 year ago

tchupp commented 1 year ago

Pretty much the title!

I haven't investigated other languages, as NodeJS has a relatively easy reproducible example. I imagine whatever is running inside dumb-init is less important here anyways.

~Minimum~ Small reproducible example

$ docker run --rm -it --entrypoint /bin/sh node:18-alpine3.15

> cd

> apk add python3 python2 libexecinfo libexecinfo-dev g++ make vim dumb-init

> npm install node-segfault-handler

> vim index.js
let segfaultHandler = require('node-segfault-handler');
segfaultHandler.segfault();

> echo "enough setup already!"
...

> node index.js
Segmentation fault (core dumped)

> echo $?
139

> dumb-init node index.js

> echo $?
139

> node index.js
Segmentation fault (core dumped)

> dumb-init node index.js
asottile commented 1 year ago

the shell is printing that, this has nothing to do with dumb-init

tchupp commented 1 year ago

Do you mind elaborating a little bit?

asottile commented 1 year ago

your shell is printing "Segmentation fault (core dumped)" -- for example try:

$ python3 -c "import subprocess; print(subprocess.call(('node', 'index.js')))"
-11
tchupp commented 1 year ago

Ah, interesting! So the monitor in the shell that prints "Segmentation faul (core dumped)" isn't basing that on the exit code then.

Thank you for pointing me in the right direction 😁 I found more info here that helped me understand what was going on: https://martin.uy/blog/who-prints-core-dumped-after-a-segmentation-fault/