23-10-2023 22:35:54 A: Error: spawn /home/container/node_modules/ffmpeg-static/ffmpeg EAGAIN
at ChildProcess._handle.onexit (node:internal/child_process:284:19)
at onErrorNT (node:internal/child_process:477:16)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
errno: -11,
code: 'EAGAIN',
syscall: 'spawn /home/container/node_modules/ffmpeg-static/ffmpeg',
path: '/home/container/node_modules/ffmpeg-static/ffmpeg',
spawnargs: [
'-i',
'https://cdn.galaxybot.de/sounds/support/close-mika.mp3',
'-analyzeduration',
'0',
'-loglevel',
'0',
'-f',
's16le',
'-ar',
'48000',
'-ac',
'2',
'pipe:1'
]
}```
I am playing a file with @discord.js/voice and it works 35 Times.
At the 36th attempt i get this error every time the bot is trying to start a playback
#ffmpeg EAGAIN
22 messages · Page 1 of 1 (latest)
- What's your exact discord.js
npm list discord.jsand nodenode -vversion? - Not a discord.js issue? Check out #1081585952654360687.
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!
✅Marked as resolved by OP
that's a network issue. seeing that you use a remote URL as source that's probably the reason
hm okay. But why does it work 35 times xD
24-10-2023 20:53:19 A: Error: spawn /home/container/node_modules/ffmpeg-static/ffmpeg EAGAIN
at ChildProcess._handle.onexit (node:internal/child_process:284:19)
at onErrorNT (node:internal/child_process:477:16)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
errno: -11,
code: 'EAGAIN',
syscall: 'spawn /home/container/node_modules/ffmpeg-static/ffmpeg',
path: '/home/container/node_modules/ffmpeg-static/ffmpeg',
spawnargs: [
'-i',
'/home/container/sound/support/support-rp.mp3',
'-analyzeduration',
'0',
'-loglevel',
'0',
'-f',
's16le',
'-ar',
'48000',
'-ac',
'2',
'pipe:1'
]
}```
If i load the file from the fs i get the same error..
Oh, the error comes from the spawn of the child process. My bad… seems like your 35 ffmpeg processes didn’t exit correctly and you don’t have enough resources to spawn another
And how do i terminate them?
Ih think discord js voice is doing this
if (Connection !== undefined) {
Connection.disconnect();
Connection.destroy();
}
It isn’t. If anything prism-media is doing it
okay. and is there a way to fix this issue?
Call destroy on the AudioResource when you don’t use it anymore/it ended
So do I have to stop the audio resource for its own?
How do I get the player at the following location:
leaveAndStop(client, voiceChannel) {
try {
const Connection = getVoiceConnection(voiceChannel.guild.id);
if (Connection !== undefined) {
Connection.disconnect();
Connection.destroy();
}
} catch (error) {
ErrorHandler.setDiscordContext("Error in SupportAudioManager > leaveAndStop()")
ErrorHandler.handleThrowable(error)
}
}```
You try to call disconnect and destroy on undefined there
Hello I am another Dev working on the same project, Mika just copied not all the code. It is Connection !== undefined.
How do you manage to copy everything but the ! there?
Either way, if the connection exists you can connection.state.subscription?.player.state.resource
To get the resource if it‘s still playing
I don`t know what Mika has done...😂