[Audio] Adjust max heapsize for 32 bit devices #6137

Closed
opened 2023-05-08 21:54:06 +02:00 by aikaterna · 0 comments
aikaterna commented 2023-05-08 21:54:06 +02:00 (Migrated from github.com)

What Red version are you using?

3.5.1

What were you trying to do?

Help Raspberry Pi 3b+ users in support with their bot managing and launching the Lavalink.jar.

What did you expect to happen?

I expected the bot to launch, download the jar if needed, start the jar, and then have Audio connect to it.

What actually happened?

The Lavalink.jar seemed to lock up before fully completing the startup or in some cases, lock up when a connection from Red to Lavalink was initiated. Logs were incomplete where I expected to see Red connection lines or standard Lavalink log lines.

How can we reproduce this error?

  1. Have a 32 bit OS/device with a smaller amount of RAM, like Raspbian 11 on a Pi 3b+ (with 1GB RAM, which was the case for both Red users that reported this in support)
  2. Install Red
  3. Start the bot and load audio
  4. The jar will seemingly not be able to get to a point where Red can connect to it. Running the jar as an externally managed process without an Xmx flag, or where Xmx is equal to 512mb or less, will let it launch and have Red connect (have not tested further yet, this comment is based on what I saw in Red support)

The proposed fix is:

https://github.com/Cog-Creators/Red-DiscordBot/blob/4daf81aa5b8d9140ae2295548d22566b07f64a71/redbot/cogs/audio/utils.py#L30

min(4 * 1024**3, psutil.virtual_memory().total) may work for this

github.com/Cog-Creators/Red-DiscordBot@4daf81aa5b/redbot/cogs/audio/utils.py (L39)

    _min_max = 512 * 1024**2
    max_ram_allowed = max(max_allocation * 0.5, _min_max)

I am not PRing this change myself at this point as maybe someone would like to work on this before I have time to do so. I have a Pi 3b+ in the configuration needed to reproduce this, so if there is further testing needed on a PR please let me know and I can help.

Anything else?

See https://discord.com/channels/133049272517001216/387398816317440000/1104968352625078313 in Red's support for proof that it reserves 4GB on the current version of Red

See https://discord.com/channels/133049272517001216/387398816317440000/1105198290452086814 for a second user where setting the Xmx smaller helped

### What Red version are you using? 3.5.1 ### What were you trying to do? Help Raspberry Pi 3b+ users in support with their bot managing and launching the Lavalink.jar. ### What did you expect to happen? I expected the bot to launch, download the jar if needed, start the jar, and then have Audio connect to it. ### What actually happened? The Lavalink.jar seemed to lock up before fully completing the startup or in some cases, lock up when a connection from Red to Lavalink was initiated. Logs were incomplete where I expected to see Red connection lines or standard Lavalink log lines. ### How can we reproduce this error? 1. Have a 32 bit OS/device with a smaller amount of RAM, like Raspbian 11 on a Pi 3b+ (with 1GB RAM, which was the case for both Red users that reported this in support) 2. Install Red 3. Start the bot and load audio 4. The jar will seemingly not be able to get to a point where Red can connect to it. Running the jar as an externally managed process without an Xmx flag, or where Xmx is equal to 512mb or less, will let it launch and have Red connect (have not tested further yet, this comment is based on what I saw in Red support) The proposed fix is: <https://github.com/Cog-Creators/Red-DiscordBot/blob/4daf81aa5b8d9140ae2295548d22566b07f64a71/redbot/cogs/audio/utils.py#L30> `min(4 * 1024**3, psutil.virtual_memory().total)` may work for this https://github.com/Cog-Creators/Red-DiscordBot/blob/4daf81aa5b8d9140ae2295548d22566b07f64a71/redbot/cogs/audio/utils.py#L39 ``` _min_max = 512 * 1024**2 max_ram_allowed = max(max_allocation * 0.5, _min_max) ``` I am not PRing this change myself at this point as maybe someone would like to work on this before I have time to do so. I have a Pi 3b+ in the configuration needed to reproduce this, so if there is further testing needed on a PR please let me know and I can help. ### Anything else? See https://discord.com/channels/133049272517001216/387398816317440000/1104968352625078313 in Red's support for proof that it reserves 4GB on the current version of Red See https://discord.com/channels/133049272517001216/387398816317440000/1105198290452086814 for a second user where setting the Xmx smaller helped
Sign in to join this conversation.
No labels
Automated PR
Blocked
Blocked By: Damage Control
Blocked By: Dependency
Blocked By: Other PR
Breaking Change
Category: CI
Category: Cogs - Admin
Category: Cogs - Alias
Category: Cogs - Audio
Category: Cogs - Bank
Category: Cogs - Cleanup
Category: Cogs - CustomCommands
Category: Cogs - Dev
Category: Cogs - Downloader
Category: Cogs - Economy
Category: Cogs - Filter
Category: Cogs - General
Category: Cogs - Image
Category: Cogs - Mod
Category: Cogs - Modlog
Category: Cogs - Mutes
Category: Cogs - Permissions
Category: Cogs - Reports
Category: Cogs - Streams
Category: Cogs - Trivia
Category: Cogs - Trivia - Lists
Category: Cogs - Warnings
Category: Core - API - App Commands Package
Category: Core - API - Audio
Category: Core - API - Bank
Category: Core - API - Commands Package
Category: Core - API - Config
Category: Core - API - Other
Category: Core - API - Utils Package
Category: Core - Bot Class
Category: Core - Bot Commands
Category: Core - Command-line Interfaces
Category: Core - Downloader
Category: Core - Help
Category: Core - i18n
Category: Core - Modlog
Category: Core - Other Internals
Category: Core - RPC/ZMQ
Category: Docker
Category: Docs - Changelogs
Category: Docs - For Developers
Category: Docs - Install Guides
Category: Docs - Other
Category: Docs - User Guides
Category: Meta
Category: RPC/ZMQ methods
Category: Vendored Packages
Changelog Entry: Added
Changelog Entry: Pending
Changelog Entry: Skipped
Closed: Duplicate
Closed: External
Closed: Invalid
Closed: User Error
Closed: Won't Fix
Complex Issue
Docs-only
Feature Branch
Good First Issue
Help Wanted
High Priority
Needs Backport To stable-docs
No Activity
No Repro
QA: Bypassed
QA: Changes Requested
QA: Passed
Release Blocker
Status: Accepted
Status: Frozen
Status: In Progress
Status: Needs Discussion
Status: Needs Info
Status: Needs Triage
Status: PRs Welcome
Type: Bug
Type: Dependency Update
Type: Deprecation
Type: Enhancement
Type: Feature
Type: Informational
Type: Merge
Type: Optimisation
Type: Question
Type: Removal
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Mrcoolgamer11/Red-DiscordBot#6137
No description provided.