Description
Library Version
5.11.0
Describe the Bug
Leaving and rejoining a voice channel with a bot recording causes enormous RAM usage and the bot recorder to stop functioning properly or the bot to crash completely (from out-of-memory). This is because the calculation for how many silence frames to insert is wrong (multiplies by sample rate twice).
Steps to Reproduce
Use whatever you prefer and start monitoring your system memory usage. Join a voice channel and have a bot join it to record. Talk and then disconnect from the voice channel. Wait 3-5 seconds and rejoin the voice channel. Memory usage will spike into the 10-20 GB range or the bot will crash.
The exact outcome and how long to wait between rejoining the voice channel really depends on the amount of memory available on your system. If you wait too long and don't have enough memory, you likely will see "Error while recording: " in the logs because Python was smart enough to not let you try to allocate that much memory. I have 64 GB of RAM, of which 32 GB is available to the bot, and it will spike up to 25 GB consistently or just crash. When it crashes, you will see "Killed" in the terminal and the exit code will be 137, which is an out-of-memory exit code.
Expected Results
The memory will not have a substantial spike and the bot will not crash.
Minimal Reproducible Code
No response
Traceback
No response
Checklist
- I have searched the open issues for duplicates.
- I have shown the entire traceback, if possible.
- I have removed my token from display, if visible.
- I have attempted to debug this myself, and I believe this issue is with the library
Additional Information
No response