discord-voice-recorder icon indicating copy to clipboard operation
discord-voice-recorder copied to clipboard

Segmentation fault (core dumped)

Open anhnhoktvn opened this issue 4 years ago • 15 comments

I got an error with fresh install and run image

anhnhoktvn avatar Jan 23 '21 18:01 anhnhoktvn

Could you be more specific? Here are some details that might help:

  1. OS
  2. Node + npm version
  3. Do you have "ffmpeg-static": "^4.2.7" installed?

chebro avatar Jan 23 '21 20:01 chebro

Sorry, here is the information:

  1. Linux mint 20
  2. node 14.10.1 + npm 6.14.8
  3. yes I just cloned the repo, npm install and npm start then opened discord, added the bot to voice channel, started talking.

anhnhoktvn avatar Jan 24 '21 01:01 anhnhoktvn

added the bot to voice channel

Did you add it manually? Or did you run the <PREFIX>enter <CHANNEL_NAME> command?

I noticed there is a username started speaking line in the console log, did you hear a drop sound before that? (see /sounds/drop.mp3)

I can't reproduce this exactly, however I have successfully tested this on an Ubuntu 18.04 machine with node v14.15.4 and npm v6.14.10 (you could try these specific versions but I highly doubt it is a version issue).

chebro avatar Jan 24 '21 06:01 chebro

You could try adding the following piece of code at the beginning of index.js and run it again, perhaps we could get some more info:

const SegfaultHandler = require('segfault-handler');
SegfaultHandler.registerHandler('crash.log');

chebro avatar Jan 24 '21 06:01 chebro

Thank you very much for your support.

Did you add it manually? Or did you run the <PREFIX>enter <CHANNEL_NAME> command?

I add it by the command !enter General

I noticed there is a username started speaking line in the console log, did you hear a drop sound before that? (see /sounds/drop.mp3)

I can hear the drop.mp3 sound

I can't reproduce this exactly, however I have successfully tested this on an Ubuntu 18.04 machine with node v14.15.4 and npm v6.14.10 (you could try these specific versions but I highly doubt it is a version issue).

I also try upgrading node to latest version ( node: 'v15.6.0', npm: '7.4.0' ) but still not work.

You could try adding the following piece of code at the beginning of index.js and run it again, perhaps we could get some more info:

Here is the log when running with node v15.6.0, npm 7.4.0

I guess something went wrong with opus decoder

[email protected] start
> node index.js


ONLINE

Sliding into General ...
anhnhoktvn started speaking
PID 1839010 received SIGSEGV for address: 0xfffffffc
/home/anhnhoktvn/data/mission/discord/discord-voice-recorder/node_modules/segfault-handler/build/Release/segfault-handler.node(+0x3785)[0x7f9420a45785]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x153c0)[0x7f94206da3c0]
/home/anhnhoktvn/data/mission/discord/discord-voice-recorder/node_modules/@discordjs/opus/prebuild/node-v88-napi-v3-linux-x64-glibc-2.31/opus.node(opus_packet_get_nb_frames+0x8)[0x7f941c409bb8]
/home/anhnhoktvn/data/mission/discord/discord-voice-recorder/node_modules/@discordjs/opus/prebuild/node-v88-napi-v3-linux-x64-glibc-2.31/opus.node(opus_packet_get_nb_samples+0x1b)[0x7f941c409c0b]
/home/anhnhoktvn/data/mission/discord/discord-voice-recorder/node_modules/@discordjs/opus/prebuild/node-v88-napi-v3-linux-x64-glibc-2.31/opus.node(opus_decode+0x144)[0x7f941c409db4]
/home/anhnhoktvn/data/mission/discord/discord-voice-recorder/node_modules/@discordjs/opus/prebuild/node-v88-napi-v3-linux-x64-glibc-2.31/opus.node(_ZN11OpusEncoder6DecodeERKN4Napi12CallbackInfoE+0x39e)[0x7f941c405fbe]
/home/anhnhoktvn/data/mission/discord/discord-voice-recorder/node_modules/@discordjs/opus/prebuild/node-v88-napi-v3-linux-x64-glibc-2.31/opus.node(_ZN4Napi10ObjectWrapI11OpusEncoderE29InstanceMethodCallbackWrapperEP10napi_env__P20napi_callback_info__+0x10a)[0x7f941c3fdafa]
node[0xa1ea4f]
node[0xcb7d1b]
node[0xcb92cc]
node(_ZN2v88internal21Builtin_HandleApiCallEiPmPNS0_7IsolateE+0x16)[0xcb9946]
node[0x14d8b79]
Segmentation fault (core dumped)



anhnhoktvn avatar Jan 24 '21 10:01 anhnhoktvn

I tried with a fresh install on a fresh Ubutu 20.10 VM. Steps:

  1. install nvm, then, install node v15.6.0 and npm v7.4.0
  2. run sudo apt-get install build-essential
  3. git clone the repo
  4. create config file, add token and prefix, create recordings folder
  5. run npm install
  6. See error:
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: '[email protected]',
npm WARN EBADENGINE   required: { node: '~12.16.1' },
npm WARN EBADENGINE   current: { node: 'v15.6.0', npm: '7.4.0' }
npm WARN EBADENGINE }
npm ERR! code 1
npm ERR! path /home/anhnhoktvn/test/discord-voice-recorder/node_modules/@discordjs/opus
npm ERR! command failed
npm ERR! command sh -c node-gyp rebuild
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | linux | x64
npm ERR! gyp info find Python using Python version 3.8.6 found at "/usr/bin/python3"
npm ERR! gyp info spawn /usr/bin/python3
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   '/home/anhnhoktvn/.nvm/versions/node/v15.6.0/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args   'binding.gyp',
npm ERR! gyp info spawn args   '-f',
npm ERR! gyp info spawn args   'make',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/home/anhnhoktvn/test/discord-voice-recorder/node_modules/@discordjs/opus/build/config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/home/anhnhoktvn/.nvm/versions/node/v15.6.0/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/home/anhnhoktvn/.cache/node-gyp/15.6.0/include/node/common.gypi',
npm ERR! gyp info spawn args   '-Dlibrary=shared_library',
npm ERR! gyp info spawn args   '-Dvisibility=default',
npm ERR! gyp info spawn args   '-Dnode_root_dir=/home/anhnhoktvn/.cache/node-gyp/15.6.0',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/home/anhnhoktvn/.nvm/versions/node/v15.6.0/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=/home/anhnhoktvn/.cache/node-gyp/15.6.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=/home/anhnhoktvn/test/discord-voice-recorder/node_modules/@discordjs/opus',
npm ERR! gyp info spawn args   '-Dnode_engine=v8',
npm ERR! gyp info spawn args   '--depth=.',
npm ERR! gyp info spawn args   '--no-parallel',
npm ERR! gyp info spawn args   '--generator-output',
npm ERR! gyp info spawn args   'build',
npm ERR! gyp info spawn args   '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp: Undefined variable module_name in binding.gyp while trying to load binding.gyp
npm ERR! gyp ERR! configure error 
npm ERR! gyp ERR! stack Error: `gyp` failed with exit code: 1
npm ERR! gyp ERR! stack     at ChildProcess.onCpExit (/home/anhnhoktvn/.nvm/versions/node/v15.6.0/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:351:16)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:379:20)
npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:285:12)
npm ERR! gyp ERR! System Linux 5.8.0-1016-gcp
npm ERR! gyp ERR! command "/home/anhnhoktvn/.nvm/versions/node/v15.6.0/bin/node" "/home/anhnhoktvn/.nvm/versions/node/v15.6.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd /home/anhnhoktvn/test/discord-voice-recorder/node_modules/@discordjs/opus
npm ERR! gyp ERR! node -v v15.6.0
npm ERR! gyp ERR! node-gyp -v v7.1.2
npm ERR! gyp ERR! not ok

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/anhnhoktvn/.npm/_logs/2021-01-24T10_45_12_906Z-debug.log

anhnhoktvn avatar Jan 24 '21 10:01 anhnhoktvn

I guess something went wrong with opus decoder

You are right, unfortunately, something is wrong with your environment, the recorder crashes at startup :( This has nothing to do with the script. You could file a bug report to @discord/opus.

npm WARN EBADENGINE required: { node: '~12.16.1' }

I'm sorry this is my fault, I should have updated the package.json. For now, you can fix this by removing the following lines from package.json:

	"engines": {
		"node": "~12.16.1"
	},

chebro avatar Jan 24 '21 11:01 chebro

Thank you. I will report it to the library repo. I have managed to get a different error. This is really weird library.


FATAL ERROR: Error::ThrowAsJavaScriptException napi_throw
 1: 0xa6ae50 node::Abort() [node]
 2: 0x99dc4d node::FatalError(char const*, char const*) [node]
 3: 0x99dc56  [node]
 4: 0xa3b77b napi_fatal_error [node]
 5: 0x7fa3b02e3c8e  [/home/anhnhoktvn/data/mission/discord/discord-voice-recorder/node_modules/@discordjs/opus/prebuild/node-v88-napi-v3-linux-x64-glibc-2.31/opus.node]
 6: 0x7fa3b02e43ec Napi::Error::ThrowAsJavaScriptException() const [/home/anhnhoktvn/data/mission/discord/discord-voice-recorder/node_modules/@discordjs/opus/prebuild/node-v88-napi-v3-linux-x64-glibc-2.31/opus.node]
 7: 0x7fa3b02f0c98 OpusEncoder::Decode(Napi::CallbackInfo const&) [/home/anhnhoktvn/data/mission/discord/discord-voice-recorder/node_modules/@discordjs/opus/prebuild/node-v88-napi-v3-linux-x64-glibc-2.31/opus.node]
 8: 0x7fa3b02e7b1a Napi::InstanceWrap<OpusEncoder>::InstanceMethodCallbackWrapper(napi_env__*, napi_callback_info__*) [/home/anhnhoktvn/data/mission/discord/discord-voice-recorder/node_modules/@discordjs/opus/prebuild/node-v88-napi-v3-linux-x64-glibc-2.31/opus.node]
 9: 0xa1ea4f  [node]
10: 0xcb7d1b  [node]
11: 0xcb92cc  [node]
12: 0xcb9946 v8::internal::Builtin_HandleApiCall(int, unsigned long*, v8::internal::Isolate*) [node]
13: 0x14d8b79  [node]
Aborted (core dumped)

``

anhnhoktvn avatar Jan 24 '21 11:01 anhnhoktvn

I have managed to get a different error.

As I said, I cannot help you with these errors because opus.node is fault, however I'll leave this issue open until someone finds a fix.

If you're still struggling, I suggest you give docker a shot. Docker containers should work anywhere ;)

chebro avatar Jan 24 '21 11:01 chebro

i have this problem, "Segmentation fault (core dumped)".

I run docker container, Dockerfile this project.

brenowd avatar Jan 29 '21 16:01 brenowd

"Segmentation fault (core dumped)".

Unfortunately there isn't much I can do here as I am unable to reproduce this at my end. You could try following the previous comments to debug yourself, if the problem is with @discordjs/opus, you should probably file a bug report on their git repo.

chebro avatar Jan 31 '21 14:01 chebro

"Segmentation fault (core dumped)".

Unfortunately there isn't much I can do here as I am unable to reproduce this at my end. You could try following the previous comments to debug yourself, if the problem is with @discordjs/opus, you should probably file a bug report on their git repo.

Did you try to use a browser based discord client? Because this error happens only using browser client. For aondroid client it works fine

stealth-program avatar Apr 03 '21 17:04 stealth-program

Did you try to use a browser based discord client? Because this error happens only using browser client. For aondroid client it works fine

Just tested this on firefox v87.0, node v14.15.4 and npm 6.14.10 with absolutely no issues. Are you sure about this?

chebro avatar Apr 04 '21 06:04 chebro

@chebro Can you try with chrome browser ?

See https://github.com/discordjs/discord.js/issues/5105

astariul avatar Sep 04 '21 14:09 astariul

@chebro I found the problem !

Somehow when I did npm i it didn't install the specific commit mentioned in package.json.

I could see it because after installation, the file /node_modules/discord.js/src/client/voice/receiver/PacketHandler.js didn't contain the changes of the PR fixing the issue in Chrome.


So to fix it, I had to install the specific version manually :

npm i
npm install discord.js@github:discordjs/discord.js#af00ec8970e77ea8a0afd21571eeeef9c554e1ec

astariul avatar Sep 04 '21 15:09 astariul