Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raspberry Pi OS, malloc() when running script #34828

Closed
FlorSanders opened this issue Aug 18, 2020 · 4 comments
Closed

Raspberry Pi OS, malloc() when running script #34828

FlorSanders opened this issue Aug 18, 2020 · 4 comments
Labels
wrong repo Issues that should be opened in another repository.

Comments

@FlorSanders
Copy link

  • Version: 14.7.0
  • Platform: Raspberry Pi OS (32-bit) Lite
  • Subsystem: Debian Buster

What steps will reproduce the bug?

Running the program included in the RMLMapper subfolder of this repo I'm working on, causes the following output on Raspberry Pi OS (Debian Buster):

node index.mjs
malloc(): invalid size (unsorted)
Aborted

This doesn't happen when running on windows.
All necessary dependencies are installed through npm and node does run when starting node through the command line.

How often does it reproduce? Is there a required condition?

Any time I start the program on the raspberry pi.

What is the expected behavior?

The expected behavior is for the program to start running.

What do you see instead?

As already mentioned:

node index.mjs
malloc(): invalid size (unsorted)
Aborted

Additional information

Since only a malloc() error is thrown with no further information I suppose it has something to do with the node environment itself, though I'm not sure. In any case there's too little information here for me to debug it on my own.
Any help that might resolve this issue would be really appreciated.

@bnoordhuis
Copy link
Member

What does find node_modules/ -name \*.node print? What happens when you run node under gdb? (gdb --args node index.mjs, then r to start the program and bt to print a stack trace after it aborts.)

@FlorSanders
Copy link
Author

find node_modules/ -name \*.node prints the following:

node_modules/xpath-iterator/build/Release/obj.target/xpathWrapper.node
node_modules/xpath-iterator/build/Release/xpathWrapper.node

Running node under gdb yields the following results:

GNU gdb (Raspbian 8.2.1-2) 8.2.1
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "arm-linux-gnueabihf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from node...done.
(gdb) r
Starting program: /home/pi/.nvm/versions/node/v14.7.0/bin/node index.mjs
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".
[New Thread 0x76c1a440 (LWP 32112)]
[New Thread 0x762ff440 (LWP 32113)]
[New Thread 0x75afe440 (LWP 32114)]
[New Thread 0x752fd440 (LWP 32115)]
[New Thread 0x74afc440 (LWP 32116)]
[New Thread 0x76ff8440 (LWP 32117)]
[New Thread 0x73cff440 (LWP 32118)]
[New Thread 0x734fe440 (LWP 32119)]
[New Thread 0x72cfd440 (LWP 32120)]
[New Thread 0x724fc440 (LWP 32121)]
[Detaching after fork from child process 32122]
[Detaching after fork from child process 32129]
[Detaching after fork from child process 32130]
[Detaching after fork from child process 32143]
[Detaching after fork from child process 32150]
[Detaching after fork from child process 32151]
malloc(): invalid size (unsorted)

Thread 1 "node" received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
50      ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x76c36230 in __GI_abort () at abort.c:79
#2  0x76c8651c in __libc_message (action=action@entry=do_abort, fmt=<optimized out>) at ../sysdeps/posix/libc_fatal.c:181
#3  0x76c8d044 in malloc_printerr (str=<optimized out>) at malloc.c:5341
#4  0x76c9068c in _int_malloc (av=av@entry=0x76d697d4 <main_arena>, bytes=bytes@entry=44) at malloc.c:3732
#5  0x76c92318 in __GI___libc_malloc (bytes=44) at malloc.c:3057
#6  0x76eb8f60 in operator new(unsigned int) () from /usr/lib/arm-linux-gnueabihf/libstdc++.so.6
#7  0x70e73a70 in node::options_parser::OptionsParser<node::PerProcessOptions>::AddOption(char const*, char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > node::PerProcessOptions::*, node::options_parser::OptionEnvvarSettings) () from /usr/lib/arm-linux-gnueabihf/libnode.so.64
#8  0x70e6e0f0 in node::options_parser::PerProcessOptionsParser::PerProcessOptionsParser() () from /usr/lib/arm-linux-gnueabihf/libnode.so.64
#9  0x70dbab18 in ?? () from /usr/lib/arm-linux-gnueabihf/libnode.so.64
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

@bnoordhuis
Copy link
Member

Try excluding that xpath-iterator module, just in case.

If that doesn't fix it, please report your issue to whoever provided you with the binary (debian?) because I can tell from the fact that it's linked to /usr/lib/arm-linux-gnueabihf/libnode.so.64 that it isn't an official binary from https://nodejs.org/.

I'm going to close this but I can move it to nodejs/help if you have follow-up questions.

@bnoordhuis bnoordhuis added the wrong repo Issues that should be opened in another repository. label Aug 19, 2020
@FlorSanders
Copy link
Author

Thanks for pointing out that it had nothing to do with the node.js core.
I had installed node.js and npm through nvm, which apparently was the cause of the issue.
After uninstalling that and installing the latest stable release from the nodejs.org website everything runs fine.
My bad. Really appreciate the help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wrong repo Issues that should be opened in another repository.
Projects
None yet
Development

No branches or pull requests

2 participants