[V3 Audio] Unable to set external lavalink #2306

Closed
opened 2018-11-21 07:29:24 +01:00 by mikeshardmind · 3 comments
mikeshardmind commented 2018-11-21 07:29:24 +01:00 (Migrated from github.com)

Right now, audio can't be loaded if lavalink can't be started. If the reason it can't be started is the port is already in use by another instance or by something completely unrelated, then the cog can't be configured to use an external lavalink server, and thus gets locked in an inability to load it.

I think the best method to fix this would be to load the cog even without the lavalink server, but place a check on commands that need lavalink that blocks them if there is no lavalink server connection. This would allow remedying this without having to interfere with other running processes, shut down other instances, or manually modify configuration files.

Right now, audio can't be loaded if lavalink can't be started. If the reason it can't be started is the port is already in use by another instance or by something completely unrelated, then the cog can't be configured to use an external lavalink server, and thus gets locked in an inability to load it. I think the best method to fix this would be to load the cog even without the lavalink server, but place a check on commands that need lavalink that blocks them if there is no lavalink server connection. This would allow remedying this without having to interfere with other running processes, shut down other instances, or manually modify configuration files.
calebj commented 2018-11-23 05:45:28 +01:00 (Migrated from github.com)

👍 for this. I have a fix that enables the external connection based on environmental variable in my docker-compose setup, but an update that allows the cog to load and attempt init/connect in the background would be more ideal.

:+1: for this. I have a fix that enables the external connection based on environmental variable in my docker-compose setup, but an update that allows the cog to load and attempt init/connect in the background would be more ideal.
aikaterna commented 2019-02-16 01:57:48 +01:00 (Migrated from github.com)

I've been speaking with Caleb in DMs about #2335, but on Windows computers the IndexErrors added in Audio to catch a missing Lavalink server are not firing, resulting in a traceback.

[04/02/2019 21:27] ERROR events on_command_error 208: Exception in command 'play'
Traceback (most recent call last):
  File "c:\program files\python37\lib\site-packages\aiohttp\connector.py", line 822, in _wrap_create_connection
    return await self._loop.create_connection(*args, **kwargs)
  File "c:\program files\python37\lib\asyncio\base_events.py", line 943, in create_connection
    raise exceptions[0]
  File "c:\program files\python37\lib\asyncio\base_events.py", line 930, in create_connection
    await self.sock_connect(sock, address)
  File "c:\program files\python37\lib\asyncio\proactor_events.py", line 545, in sock_connect
    return await self._proactor.connect(sock, address)
  File "c:\program files\python37\lib\asyncio\windows_events.py", line 732, in _poll
    value = callback(transferred, key, ov)
  File "c:\program files\python37\lib\asyncio\windows_events.py", line 524, in finish_connect
    ov.getresult()
ConnectionRefusedError: [WinError 1225] The remote computer refused the network connection

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "c:\program files\python37\lib\site-packages\discord\ext\commands\core.py", line 79, in wrapped
    ret = await coro(*args, **kwargs)
  File "c:\program files\python37\lib\site-packages\redbot\cogs\audio\audio.py", line 960, in play
    tracks = await player.get_tracks(query)
  File "c:\program files\python37\lib\site-packages\lavalink\rest_api.py", line 155, in get_tracks
    async with self._session.get(url, headers=self._headers) as resp:
  File "c:\program files\python37\lib\site-packages\aiohttp\client.py", line 855, in __aenter__
    self._resp = await self._coro
  File "c:\program files\python37\lib\site-packages\aiohttp\client.py", line 370, in _request
    timeout=timeout
  File "c:\program files\python37\lib\site-packages\aiohttp\connector.py", line 445, in connect
    proto = await self._create_connection(req, traces, timeout)
  File "c:\program files\python37\lib\site-packages\aiohttp\connector.py", line 757, in _create_connection
    req, traces, timeout)
  File "c:\program files\python37\lib\site-packages\aiohttp\connector.py", line 879, in _create_direct_connection
    raise last_exc
  File "c:\program files\python37\lib\site-packages\aiohttp\connector.py", line 862, in _create_direct_connection
    req=req, client_error=client_error)
  File "c:\program files\python37\lib\site-packages\aiohttp\connector.py", line 829, in _wrap_create_connection
    raise client_error(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host localhost:2333 ssl:None [The remote computer refused the network connection]
I've been speaking with Caleb in DMs about #2335, but on Windows computers the IndexErrors added in Audio to catch a missing Lavalink server are not firing, resulting in a traceback. ``` [04/02/2019 21:27] ERROR events on_command_error 208: Exception in command 'play' Traceback (most recent call last): File "c:\program files\python37\lib\site-packages\aiohttp\connector.py", line 822, in _wrap_create_connection return await self._loop.create_connection(*args, **kwargs) File "c:\program files\python37\lib\asyncio\base_events.py", line 943, in create_connection raise exceptions[0] File "c:\program files\python37\lib\asyncio\base_events.py", line 930, in create_connection await self.sock_connect(sock, address) File "c:\program files\python37\lib\asyncio\proactor_events.py", line 545, in sock_connect return await self._proactor.connect(sock, address) File "c:\program files\python37\lib\asyncio\windows_events.py", line 732, in _poll value = callback(transferred, key, ov) File "c:\program files\python37\lib\asyncio\windows_events.py", line 524, in finish_connect ov.getresult() ConnectionRefusedError: [WinError 1225] The remote computer refused the network connection The above exception was the direct cause of the following exception: Traceback (most recent call last): File "c:\program files\python37\lib\site-packages\discord\ext\commands\core.py", line 79, in wrapped ret = await coro(*args, **kwargs) File "c:\program files\python37\lib\site-packages\redbot\cogs\audio\audio.py", line 960, in play tracks = await player.get_tracks(query) File "c:\program files\python37\lib\site-packages\lavalink\rest_api.py", line 155, in get_tracks async with self._session.get(url, headers=self._headers) as resp: File "c:\program files\python37\lib\site-packages\aiohttp\client.py", line 855, in __aenter__ self._resp = await self._coro File "c:\program files\python37\lib\site-packages\aiohttp\client.py", line 370, in _request timeout=timeout File "c:\program files\python37\lib\site-packages\aiohttp\connector.py", line 445, in connect proto = await self._create_connection(req, traces, timeout) File "c:\program files\python37\lib\site-packages\aiohttp\connector.py", line 757, in _create_connection req, traces, timeout) File "c:\program files\python37\lib\site-packages\aiohttp\connector.py", line 879, in _create_direct_connection raise last_exc File "c:\program files\python37\lib\site-packages\aiohttp\connector.py", line 862, in _create_direct_connection req=req, client_error=client_error) File "c:\program files\python37\lib\site-packages\aiohttp\connector.py", line 829, in _wrap_create_connection raise client_error(req.connection_key, exc) from exc aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host localhost:2333 ssl:None [The remote computer refused the network connection] ```
calebj commented 2019-02-16 02:36:30 +01:00 (Migrated from github.com)

@aikaterna can you verify Red-Lavalink 0.2.2 is installed? I pushed a commit that fixed a return type for one of the check functions, but I might have to open another PR for it.

@aikaterna can you verify Red-Lavalink 0.2.2 is installed? I pushed a commit that fixed a return type for one of the check functions, but I might have to open another PR for it.
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#2306
No description provided.