Repository navigation
Segmentation fault of node 10.8.0 x64 on Fedora 27 when running from PATH #22319
Copy link
Copy link
Closed
Description
- Version:
node --version
v10.8.0
- Platform:
$ cat /etc/os-release
NAME=Fedora
VERSION="27 (Twenty Seven)"
ID=fedora
VERSION_ID=27
PRETTY_NAME="Fedora 27 (Twenty Seven)"
ANSI_COLOR="0;34"
CPE_NAME="cpe:/o:fedoraproject:fedora:27"
HOME_URL="https://fedoraproject.org/"
SUPPORT_URL="https://fedoraproject.org/wiki/Communicating_and_getting_help"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_BUGZILLA_PRODUCT="Fedora"
REDHAT_BUGZILLA_PRODUCT_VERSION=27
REDHAT_SUPPORT_PRODUCT="Fedora"
REDHAT_SUPPORT_PRODUCT_VERSION=27
PRIVACY_POLICY_URL="https://fedoraproject.org/wiki/Legal:PrivacyPolicy"
$ uname -a
Linux edison 4.17.12-100.fc27.x86_64 #1 SMP Fri Aug 3 15:00:33 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
- Subsystem: Node
I get a segfault just by running node -- no arguments, just trying to get an interactive shell:
$ type node
node is /opt/node-v10.8.0-linux-x64/bin/node
$ node
fish: “node” terminated by signal SIGSEGV (Address boundary error)
Here is the output from coredumpctl:
PID: 91027 (node)
UID: 1000 (raman)
GID: 1000 (raman)
Signal: 11 (SEGV)
Timestamp: Tue 2018-08-14 12:06:28 EDT (5s ago)
Command Line: node
Executable: /opt/node-v10.8.0-linux-x64/bin/node
Control Group: /user.slice/user-1000.slice/session-2.scope
Unit: session-2.scope
Slice: user-1000.slice
Session: 2
Owner UID: 1000 (raman)
Boot ID: 6d5855baaf2c4f51ad2472a1a4631ae8
Machine ID: ced7a5bf77e545c28c0ba7b313e98ca1
Hostname: edison
Storage: /var/lib/systemd/coredump/core.node.1000.6d5855baaf2c4f51ad2472a1a4631ae8.91027.1534262788000000.lz4
Message: Process 91027 (node) of user 1000 dumped core.
Stack trace of thread 91027:
#0 0x00007ff3938b8c5a _ZN2v816FunctionTemplate3NewEPNS_7IsolateEPFvRKNS_20FunctionCallbackInfoINS_5ValueEEEENS_5LocalIS4_EENSA_INS_9SignatureEEEi (libnode.so)
#1 0x00007ff393e52481 _ZN4node17ContextifyContext4InitEPNS_11EnvironmentEN2v85LocalINS3_6ObjectEEE (libnode.so)
#2 0x00007ff393e52443 _ZN4node14InitContextifyEN2v85LocalINS0_6ObjectEEENS1_INS0_5ValueEEENS1_INS0_7ContextEEE (libnode.so)
#3 0x00000000008baff3 _ZN4nodeL10GetBindingERKN2v820FunctionCallbackInfoINS0_5ValueEEE (node)
#4 0x0000000000b4ee49 _ZN2v88internal12_GLOBAL__N_119HandleApiCallHelperILb0EEENS0_11MaybeHandleINS0_6ObjectEEEPNS0_7IsolateENS0_6HandleINS0_10HeapObjectEEESA_NS8_INS0_20FunctionTemplateInfoEEENS8_IS4_EENS0_16B
#5 0x0000000000b4f9b9 _ZN2v88internal21Builtin_HandleApiCallEiPPNS0_6ObjectEPNS0_7IsolateE (node)
#6 0x00001fb8db2841bd n/a (n/a)
#7 0x00001fb8db293a09 n/a (n/a)
#8 0x00001fb8db293a09 n/a (n/a)
#9 0x00001fb8db290f95 n/a (n/a)
#10 0x00001fb8db28a4a1 n/a (n/a)
#11 0x0000000000e597f3 _ZN2v88internal9Execution4CallEPNS0_7IsolateENS0_6HandleINS0_6ObjectEEES6_iPS6_ (node)
#12 0x0000000000ae84b3 _ZN2v88Function4CallENS_5LocalINS_7ContextEEENS1_INS_5ValueEEEiPS5_ (node)
#13 0x00000000008be828 _ZN4node15LoadEnvironmentEPNS_11EnvironmentE (node)
#14 0x00000000008c2c96 _ZN4node5StartEPN2v87IsolateEPNS_11IsolateDataEiPKPKciS8_ (node)
#15 0x00000000008c191f _ZN4node5StartEiPPc (node)
#16 0x00007ff396579f2a __libc_start_main (libc.so.6)
#17 0x000000000087dbe5 _start (node)
This is running node directly from the tar.xz download on nodejs.org (sha256 sum verified).
Node 8 and 9 work without any issues.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Activity
rocketraman commentedon Aug 14, 2018
Just tried
node-v10.8.1-nightly2018081382830a809b-linux-x64, and it works fine. So it seems this issue was already fixed somewhere along the way.rocketraman commentedon Aug 14, 2018
Update, ok this is super-strange... never mind my last comment, the nightly has the same issue. It appears that the problem happens only when node is executed via a directory in the
PATH:Works fine when running
nodewith the full path specified:But borks when running the same binary from the
PATH:Also, it works fine as
root, but not as an unprivileged user. Selinux does not appear to be the culprit.[-]Segmentation fault of node 10.8.0 x64 on Fedora 27[/-][+]Segmentation fault of node 10.8.0 x64 on Fedora 27 when running from `PATH`[/+]richardlau commentedon Aug 16, 2018
The tar.xz download from nodejs.org doesn't contain nor link to
libnode.soso this looks like interference with another Node.js installation.rocketraman commentedon Aug 16, 2018
Ah, interesting. Do you have any idea why this might be happening? As you can see from the
stracethe rightnodebinary is being executed. I confirm it does not link tolibnode.so:And this issue does not happen with either node 8 or 9, which are installed in exactly the same way as 10.
rocketraman commentedon Aug 16, 2018
Attached is the output of
LD_DEBUG=all node. It contains the following:ld-debug.txt.gz
rocketraman commentedon Aug 16, 2018
I found out that
libnode.sowas owned byatom-libs, which appears to have been a leftover package since I uninstalled atom a while ago. Removing this package has fixed the problem, but I still find it odd that node 10 attempts to dynamically load this shared lib, which node 8 and 9 did not, and only in some cases such as not running it with an absolute path. While this is solved from my perspective, it certainly seems like this could be some bad logic in node 10.richardlau commentedon Aug 16, 2018
At this point I'd cc @nodejs/platform-linux but we don't appear to have such a group 😞 .
hmt commentedon Sep 20, 2018
On Fedora 28 I had the same issue. I have no clue where my libnode.so came from. But thanks for giving the full debug logs. Learnt something new about strace and coredumps. 👍
rocketraman commentedon Sep 21, 2018
@hmt You can try
The path you can get from the output of
LD_DEBUG=all node.That might tell you something useful about which rpm it came from, and if it isn't a package on your system then it was probably installed manually at some point.
I still think that something is wrong with nodes internals though.
Trott commentedon Nov 21, 2018
@nodejs/build Any thoughts/insights on this one?
rvagg commentedon Nov 22, 2018
nope, and I agree, Node shouldn't be trying to load libnode if it's a stand-alone build. I'm trying to find something in the commit list for 10 that are not in 8 that might point to a change that might be implicated but nothing is standing out. There has been a little bit of work to make compiling Node as a shared library so perhaps it's related to that. 🤷♂️ @bnoordhuis any thoughts on where to look for this one?
Trott commentedon Nov 26, 2018
If It's specific to Fedora and/or other Red Hat OSes, maybe @danbev or @lance might have an idea?
danbev commentedon Nov 27, 2018
Nothing I can think of without having a closer look I'm afraid. If I have time I'll try to take a look later this week but it might not be until next week as this is a short week for me (not working Friday).
richardlau commentedon Jan 30, 2019
#25733 looks similar and was reported on Ubuntu.
gireeshpunathil commentedon Jan 3, 2020
@rocketraman - is it still reproducible?
IMO this has something to do with dynamic linker / loader's symbol lookup being over-riden by some system settings.
excerpts from the dump:
this would mean the symbol
register_async_wrap, despite being present (statically bound) innode, was superseded inlibnode.so!excerpts from strace:
the library was loaded (soon?) after the ld cache was contacted, indicating the library being selected by some system (ld) config?
is there any output from
$ ldconfig -p | grep nodeis there any output from
$ env | grep LD_rocketraman commentedon Jan 8, 2020
@gireeshpunathil Yes, easily reproducible.
As I noted in comment #22319 (comment) the latter of those two comes from atom-libs:
and when that is removed, the problem goes away.
As also mentioned previously, when node is run as
nodeit SIGSEGV, but if run with the absolute path, it works fine.gireeshpunathil commentedon Jan 9, 2020
@rocketraman - I tried the same steps, but could not reproduce this issue. At the same time, I am unable to mimic the setting that resulted in your ouput of
ldconfig -p | grep node- I installed atom usingdnf install. Do you know what system configuration resulted inlibnode.sobeing specially treated byldconfig?rocketraman commentedon Jan 9, 2020
@gireeshpunathil I installed atom a long time ago, and I found the rpm for
atom-libswhich provides that extra libnode.so in my local dnf repo. Here it is:atom-libs.zip
Give that a shot?
gireeshpunathil commentedon Jan 9, 2020
ah! that did the trick! thanks.
same as your case!
I will debug this!
gireeshpunathil commentedon Jan 10, 2020
ok, further insights:
this
rpmindeed updateslibnode.sofor dynamic linker's run-time bindings cache, effectively bringing the symbols of the library for lookup for executables built with runtime linking option (-lrt).If the object reference (node) does not contain slashes in it, the dynamic linker/loader searches the cache file /etc/ld.so.cache for libraries to be used for symbol lookup that is required in the said object. In this case, the cache was populated by
ldconfig.upto node v11.6.0 , node is built with
-lrtoptionpay special attention to
librt.so.1.So this explains:
Hope this helps.
gireeshpunathil commentedon Jan 17, 2020
@rocketraman - any concerns / observations on the above finding? I am closing this as resolved, feel free to re-open if you think there is something outstanding.
rocketraman commentedon Jan 17, 2020
Thanks @gireeshpunathil -- note that node 8 and 9 also did not suffer from this issue, so it looks like the librt stuff was added in 10, and then removed again in 11.7? I can't pretend to understand all the intricacies of this, but it sounds like the behavior has been explained, and good workarounds are available, so I'm good with closing it. Thanks!
7xt commentedon Mar 26, 2020
can someone explain this issue in layman term? I'm new in nodejs.
rocketraman commentedon Mar 26, 2020
@od2 Basically node 10 to 11.7 had an alternate library loading mechanism (via librt) which was broken in certain situations, which includes loading an external (and incorrect) libnode when running node from the PATH (i.e. having no slashes in the executable name).
To "solve" the problem do one of the following:
/path/to/nodeinstead of justnode, or