Repository: Cog-Creators/Red-DiscordBot

Issue:
[Audio] Internal Lavalink.jar looping on startup
When starting the audio module with internal lavalink.jar the lavalink server never fully starts continuously restarting. This behavior will continue even after unloading the audio cog, only stopping after the bot is closed.

Setting the lavalink server as external on localhost and starting it manually allows it to fully start and work. This behavior wasn't present on 3.0.0

lavalink.log when started by  audio cog:
```
[13:10:25] [ INFO ] [Launcher] 

[32m       .  [31m _                  _ _       _    [32m__ _ _
[32m      /\\ [31m| | __ ___   ____ _| (_)_ __ | | __[32m\ \ \ \
[32m     ( ( )[31m| |/ _` \ \ / / _` | | | '_ \| |/ /[32m \ \ \ \
[32m      \\/ [31m| | (_| |\ V / (_| | | | | | |   < [32m  ) ) ) )
[32m       '  [31m|_|\__,_| \_/ \__,_|_|_|_| |_|_|\_\[32m / / / /
[0m    =========================================[32m/_/_/_/[0m

	Version:        2.2
	Build:          584
	Build time:     23.07.2018 17:18:37 CEST
	Branch          dev
	Commit:         a138a7b
	Commit time:    23.07.2018 17:14:31 CEST
	JVM:            11.0.2
	Lavaplayer      1.3.7

[13:10:27] [ INFO ] [Launcher] Starting Launcher on pebble with PID 8409 (/home/daf/butler/cogs/Audio/Lavalink.jar started by daf in /home/daf/butler/cogs/Audio)
[13:10:27] [ INFO ] [Launcher] No active profile set, falling back to default profiles: default
[13:10:28] [ INFO ] [AnnotationConfigServletWebServerApplicationContext] Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@455848: startup date [Sun Feb 17 13:10:28 WET 2019]; root of context hierarchy
[13:10:57] [ INFO ] [Launcher] 

[32m       .  [31m _                  _ _       _    [32m__ _ _
[32m      /\\ [31m| | __ ___   ____ _| (_)_ __ | | __[32m\ \ \ \
[32m     ( ( )[31m| |/ _` \ \ / / _` | | | '_ \| |/ /[32m \ \ \ \
[32m      \\/ [31m| | (_| |\ V / (_| | | | | | |   < [32m  ) ) ) )
[32m       '  [31m|_|\__,_| \_/ \__,_|_|_|_| |_|_|\_\[32m / / / /
[0m    =========================================[32m/_/_/_/[0m

	Version:        2.2
	Build:          584
	Build time:     23.07.2018 17:18:37 CEST
	Branch          dev
	Commit:         a138a7b
	Commit time:    23.07.2018 17:14:31 CEST
	JVM:            11.0.2
	Lavaplayer      1.3.7

[13:10:59] [ INFO ] [Launcher] Starting Launcher on pebble with PID 8442 (/home/daf/butler/cogs/Audio/Lavalink.jar started by daf in /home/daf/butler/cogs/Audio)
[13:10:59] [ INFO ] [Launcher] No active profile set, falling back to default profiles: default
[13:11:00] [ INFO ] [AnnotationConfigServletWebServerApplicationContext] Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@455848: startup date [Sun Feb 17 13:11:00 WET 2019]; root of context hierarchy
[13:11:28] [ INFO ] [Launcher] 

[32m       .  [31m _                  _ _       _    [32m__ _ _
[32m      /\\ [31m| | __ ___   ____ _| (_)_ __ | | __[32m\ \ \ \
[32m     ( ( )[31m| |/ _` \ \ / / _` | | | '_ \| |/ /[32m \ \ \ \
[32m      \\/ [31m| | (_| |\ V / (_| | | | | | |   < [32m  ) ) ) )
[32m       '  [31m|_|\__,_| \_/ \__,_|_|_|_| |_|_|\_\[32m / / / /
[0m    =========================================[32m/_/_/_/[0m

	Version:        2.2
	Build:          584
	Build time:     23.07.2018 17:18:37 CEST
	Branch          dev
	Commit:         a138a7b
	Commit time:    23.07.2018 17:14:31 CEST
	JVM:            11.0.2
	Lavaplayer      1.3.7

[13:11:30] [ INFO ] [Launcher] Starting Launcher on pebble with PID 8474 (/home/daf/butler/cogs/Audio/Lavalink.jar started by daf in /home/daf/butler/cogs/Audio)
[13:11:30] [ INFO ] [Launcher] No active profile set, falling back to default profiles: default
[13:11:31] [ INFO ] [AnnotationConfigServletWebServerApplicationContext] Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@455848: startup date [Sun Feb 17 13:11:31 WET 2019]; root of context hierarchy
[13:12:00] [ INFO ] [Launcher] 

[32m       .  [31m _                  _ _       _    [32m__ _ _
[32m      /\\ [31m| | __ ___   ____ _| (_)_ __ | | __[32m\ \ \ \
[32m     ( ( )[31m| |/ _` \ \ / / _` | | | '_ \| |/ /[32m \ \ \ \
[32m      \\/ [31m| | (_| |\ V / (_| | | | | | |   < [32m  ) ) ) )
[32m       '  [31m|_|\__,_| \_/ \__,_|_|_|_| |_|_|\_\[32m / / / /
[0m    =========================================[32m/_/_/_/[0m

	Version:        2.2
	Build:          584
	Build time:     23.07.2018 17:18:37 CEST
	Branch          dev
	Commit:         a138a7b
	Commit time:    23.07.2018 17:14:31 CEST
	JVM:            11.0.2
	Lavaplayer      1.3.7

[13:12:02] [ INFO ] [Launcher] Starting Launcher on pebble with PID 8508 (/home/daf/butler/cogs/Audio/Lavalink.jar started by daf in /home/daf/butler/cogs/Audio)
[13:12:02] [ INFO ] [Launcher] No active profile set, falling back to default profiles: default
[13:12:03] [ INFO ] [AnnotationConfigServletWebServerApplicationContext] Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@455848: startup date [Sun Feb 17 13:12:03 WET 2019]; root of context hierarchy
[13:12:32] [ INFO ] [Launcher] 

[32m       .  [31m _                  _ _       _    [32m__ _ _
[32m      /\\ [31m| | __ ___   ____ _| (_)_ __ | | __[32m\ \ \ \
[32m     ( ( )[31m| |/ _` \ \ / / _` | | | '_ \| |/ /[32m \ \ \ \
[32m      \\/ [31m| | (_| |\ V / (_| | | | | | |   < [32m  ) ) ) )
[32m       '  [31m|_|\__,_| \_/ \__,_|_|_|_| |_|_|\_\[32m / / / /
[0m    =========================================[32m/_/_/_/[0m

	Version:        2.2
	Build:          584
	Build time:     23.07.2018 17:18:37 CEST
	Branch          dev
	Commit:         a138a7b
	Commit time:    23.07.2018 17:14:31 CEST
	JVM:            11.0.2
	Lavaplayer      1.3.7

[13:12:33] [ INFO ] [Launcher] Starting Launcher on pebble with PID 8537 (/home/daf/butler/cogs/Audio/Lavalink.jar started by daf in /home/daf/butler/cogs/Audio)
[13:12:34] [ INFO ] [Launcher] No active profile set, falling back to default profiles: default
[13:12:34] [ INFO ] [AnnotationConfigServletWebServerApplicationContext] Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@455848: startup date [Sun Feb 17 13:12:34 WET 2019]; root of context hierarchy
[13:13:04] [ INFO ] [Launcher] 

[32m       .  [31m _                  _ _       _    [32m__ _ _
[32m      /\\ [31m| | __ ___   ____ _| (_)_ __ | | __[32m\ \ \ \
[32m     ( ( )[31m| |/ _` \ \ / / _` | | | '_ \| |/ /[32m \ \ \ \
[32m      \\/ [31m| | (_| |\ V / (_| | | | | | |   < [32m  ) ) ) )
[32m       '  [31m|_|\__,_| \_/ \__,_|_|_|_| |_|_|\_\[32m / / / /
[0m    =========================================[32m/_/_/_/[0m

	Version:        2.2
	Build:          584
	Build time:     23.07.2018 17:18:37 CEST
	Branch          dev
	Commit:         a138a7b
	Commit time:    23.07.2018 17:14:31 CEST
	JVM:            11.0.2
	Lavaplayer      1.3.7

[13:13:06] [ INFO ] [Launcher] Starting Launcher on pebble with PID 8573 (/home/daf/butler/cogs/Audio/Lavalink.jar started by daf in /home/daf/butler/cogs/Audio)
[13:13:06] [ INFO ] [Launcher] No active profile set, falling back to default profiles: default
[13:13:06] [ INFO ] [AnnotationConfigServletWebServerApplicationContext] Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@455848: startup date [Sun Feb 17 13:13:06 WET 2019]; root of context hierarchy
[13:13:35] [ INFO ] [Launcher] 

[32m       .  [31m _                  _ _       _    [32m__ _ _
[32m      /\\ [31m| | __ ___   ____ _| (_)_ __ | | __[32m\ \ \ \
[32m     ( ( )[31m| |/ _` \ \ / / _` | | | '_ \| |/ /[32m \ \ \ \
[32m      \\/ [31m| | (_| |\ V / (_| | | | | | |   < [32m  ) ) ) )
[32m       '  [31m|_|\__,_| \_/ \__,_|_|_|_| |_|_|\_\[32m / / / /
[0m    =========================================[32m/_/_/_/[0m

	Version:        2.2
	Build:          584
	Build time:     23.07.2018 17:18:37 CEST
	Branch          dev
	Commit:         a138a7b
	Commit time:    23.07.2018 17:14:31 CEST
	JVM:            11.0.2
	Lavaplayer      1.3.7

[13:13:37] [ INFO ] [Launcher] Starting Launcher on pebble with PID 8606 (/home/daf/butler/cogs/Audio/Lavalink.jar started by daf in /home/daf/butler/cogs/Audio)
[13:13:37] [ INFO ] [Launcher] No active profile set, falling back to default profiles: default
[13:13:38] [ INFO ] [AnnotationConfigServletWebServerApplicationContext] Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@7edb54: startup date [Sun Feb 17 13:13:38 WET 2019]; root of context hierarchy
[13:14:07] [ INFO ] [Launcher] 

[32m       .  [31m _                  _ _       _    [32m__ _ _
[32m      /\\ [31m| | __ ___   ____ _| (_)_ __ | | __[32m\ \ \ \
[32m     ( ( )[31m| |/ _` \ \ / / _` | | | '_ \| |/ /[32m \ \ \ \
[32m      \\/ [31m| | (_| |\ V / (_| | | | | | |   < [32m  ) ) ) )
[32m       '  [31m|_|\__,_| \_/ \__,_|_|_|_| |_|_|\_\[32m / / / /
[0m    =========================================[32m/_/_/_/[0m

	Version:        2.2
	Build:          584
	Build time:     23.07.2018 17:18:37 CEST
	Branch          dev
	Commit:         a138a7b
	Commit time:    23.07.2018 17:14:31 CEST
	JVM:            11.0.2
	Lavaplayer      1.3.7

[13:14:09] [ INFO ] [Launcher] Starting Launcher on pebble with PID 8643 (/home/daf/butler/cogs/Audio/Lavalink.jar started by daf in /home/daf/butler/cogs/Audio)
[13:14:09] [ INFO ] [Launcher] No active profile set, falling back to default profiles: default
[13:14:10] [ INFO ] [AnnotationConfigServletWebServerApplicationContext] Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@455848: startup date [Sun Feb 17 13:14:10 WET 2019]; root of context hierarchy
[13:14:39] [ INFO ] [Launcher] 

[32m       .  [31m _                  _ _       _    [32m__ _ _
[32m      /\\ [31m| | __ ___   ____ _| (_)_ __ | | __[32m\ \ \ \
[32m     ( ( )[31m| |/ _` \ \ / / _` | | | '_ \| |/ /[32m \ \ \ \
[32m      \\/ [31m| | (_| |\ V / (_| | | | | | |   < [32m  ) ) ) )
[32m       '  [31m|_|\__,_| \_/ \__,_|_|_|_| |_|_|\_\[32m / / / /
[0m    =========================================[32m/_/_/_/[0m

	Version:        2.2
	Build:          584
	Build time:     23.07.2018 17:18:37 CEST
	Branch          dev
	Commit:         a138a7b
	Commit time:    23.07.2018 17:14:31 CEST
	JVM:            11.0.2
	Lavaplayer      1.3.7

[13:14:40] [ INFO ] [Launcher] Starting Launcher on pebble with PID 8675 (/home/daf/butler/cogs/Audio/Lavalink.jar started by daf in /home/daf/butler/cogs/Audio)
[13:14:40] [ INFO ] [Launcher] No active profile set, falling back to default profiles: default
[13:15:10] [ INFO ] [Launcher] 

[32m       .  [31m _                  _ _       _    [32m__ _ _
[32m      /\\ [31m| | __ ___   ____ _| (_)_ __ | | __[32m\ \ \ \
[32m     ( ( )[31m| |/ _` \ \ / / _` | | | '_ \| |/ /[32m \ \ \ \
[32m      \\/ [31m| | (_| |\ V / (_| | | | | | |   < [32m  ) ) ) )
[32m       '  [31m|_|\__,_| \_/ \__,_|_|_|_| |_|_|\_\[32m / / / /
[0m    =========================================[32m/_/_/_/[0m

	Version:        2.2
	Build:          584
	Build time:     23.07.2018 17:18:37 CEST
	Branch          dev
	Commit:         a138a7b
	Commit time:    23.07.2018 17:14:31 CEST
	JVM:            11.0.2
	Lavaplayer      1.3.7

[13:15:12] [ INFO ] [Launcher] Starting Launcher on pebble with PID 8704 (/home/daf/butler/cogs/Audio/Lavalink.jar started by daf in /home/daf/butler/cogs/Audio)
[13:15:12] [ INFO ] [Launcher] No active profile set, falling back to default profiles: default
[13:15:13] [ INFO ] [AnnotationConfigServletWebServerApplicationContext] Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@7edb54: startup date [Sun Feb 17 13:15:13 WET 2019]; root of context hierarchy
```

lavalink.log started as external on localhost
```
[13:52:03] [ INFO ] [Launcher] 

[32m       .  [31m _                  _ _       _    [32m__ _ _
[32m      /\\ [31m| | __ ___   ____ _| (_)_ __ | | __[32m\ \ \ \
[32m     ( ( )[31m| |/ _` \ \ / / _` | | | '_ \| |/ /[32m \ \ \ \
[32m      \\/ [31m| | (_| |\ V / (_| | | | | | |   < [32m  ) ) ) )
[32m       '  [31m|_|\__,_| \_/ \__,_|_|_|_| |_|_|\_\[32m / / / /
[0m    =========================================[32m/_/_/_/[0m

	Version:        2.2
	Build:          584
	Build time:     23.07.2018 17:18:37 CEST
	Branch          dev
	Commit:         a138a7b
	Commit time:    23.07.2018 17:14:31 CEST
	JVM:            11.0.2
	Lavaplayer      1.3.7

[13:52:05] [ INFO ] [Launcher] Starting Launcher on pebble with PID 10031 (/home/daf/butler/cogs/Audio/Lavalink.jar.fixed-offical started by daf in /home/daf/butler/cogs/Audio)
[13:52:05] [ INFO ] [Launcher] No active profile set, falling back to default profiles: default
[13:52:06] [ INFO ] [AnnotationConfigServletWebServerApplicationContext] Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@138449f: startup date [Sun Feb 17 13:52:06 WET 2019]; root of context hierarchy
[13:52:22] [ INFO ] [TomcatWebServer] Tomcat initialized with port(s): 2333 (http)
[13:52:23] [ INFO ] [Http11NioProtocol] Initializing ProtocolHandler ["http-nio-2333"]
[13:52:23] [ INFO ] [StandardService] Starting service [Tomcat]
[13:52:23] [ INFO ] [StandardEngine] Starting Servlet Engine: Apache Tomcat/8.5.31
[13:52:23] [ INFO ] [AprLifecycleListener] The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [/usr/java/packages/lib:/lib:/usr/lib]
[13:52:24] [ INFO ] [[/]] Initializing Spring embedded WebApplicationContext
[13:52:24] [ INFO ] [ContextLoader] Root WebApplicationContext: initialization completed in 18121 ms
[13:52:26] [ INFO ] [ServletRegistrationBean] Servlet dispatcherServlet mapped to [/]
[13:52:26] [ INFO ] [FilterRegistrationBean] Mapping filter: 'characterEncodingFilter' to: [/*]
[13:52:26] [ INFO ] [FilterRegistrationBean] Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
[13:52:26] [ INFO ] [FilterRegistrationBean] Mapping filter: 'httpPutFormContentFilter' to: [/*]
[13:52:26] [ INFO ] [FilterRegistrationBean] Mapping filter: 'requestContextFilter' to: [/*]
[13:52:27] [ INFO ] [AudioSendFactoryConfiguration] OS: Linux, Arch: arm
[13:52:27] [ WARN ] [AudioSendFactoryConfiguration] This system and architecture appears to not support native audio sending! GC pauses may cause your bot to stutter during playback.
[13:52:27] [ WARN ] [Dsn] *** Couldn't find a suitable DSN, Sentry operations will do nothing! See documentation: https://docs.sentry.io/clients/java/ ***
[13:52:27] [ WARN ] [DefaultSentryClientFactory] No 'stacktrace.app.packages' was configured, this option is highly recommended as it affects stacktrace grouping and display on Sentry. See documentation: https://docs.sentry.io/clients/java/config/#in-application-stack-frames
[13:52:27] [ INFO ] [Launcher] No sentry dsn found, turning off sentry.
[13:52:28] [ INFO ] [SocketServer] Started WS server with port 2332
[13:52:34] [ INFO ] [GarbageCollectionMonitor] GC monitoring enabled, reporting results every 2 minutes.
[13:52:35] [ INFO ] [SimpleUrlHandlerMapping] Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
[13:52:36] [ INFO ] [SocketServer] Connection opened from /127.0.0.1:41380 with protocol Draft_6455 extension: DefaultExtension protocol: 
[13:52:36] [ INFO ] [GarbageCollectionMonitor] GC monitoring enabled, reporting results every 2 minutes.
[13:52:36] [ ERROR] [LinuxCentralProcessor] Couldn't find physical processor count. Assuming 1.
[13:52:36] [ ERROR] [LinuxCentralProcessor] Couldn't find physical package count. Assuming 1.
[13:52:39] [ INFO ] [RequestMappingHandlerAdapter] Looking for @ControllerAdvice: org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@138449f: startup date [Sun Feb 17 13:52:06 WET 2019]; root of context hierarchy
[13:52:40] [ INFO ] [RequestMappingHandlerMapping] Mapped "{[/debug/nashorn],methods=[POST]}" onto public java.lang.String lavalink.server.util.DebugRestHandler.getLoadTracks(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse,java.lang.String,java.lang.String)
[13:52:40] [ INFO ] [RequestMappingHandlerMapping] Mapped "{[/decodetrack],methods=[GET],produces=[application/json]}" onto public org.springframework.http.ResponseEntity<java.lang.String> lavalink.server.player.AudioLoaderRestHandler.getDecodeTrack(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse,java.lang.String) throws java.io.IOException
[13:52:40] [ INFO ] [RequestMappingHandlerMapping] Mapped "{[/decodetracks],methods=[POST],consumes=[application/json],produces=[application/json]}" onto public org.springframework.http.ResponseEntity<java.lang.String> lavalink.server.player.AudioLoaderRestHandler.postDecodeTracks(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse,java.lang.String) throws java.io.IOException
[13:52:40] [ INFO ] [RequestMappingHandlerMapping] Mapped "{[/loadtracks],methods=[GET],produces=[application/json]}" onto public java.util.concurrent.CompletionStage<org.springframework.http.ResponseEntity<java.lang.String>> lavalink.server.player.AudioLoaderRestHandler.getLoadTracks(javax.servlet.http.HttpServletRequest,java.lang.String)
[13:52:40] [ INFO ] [RequestMappingHandlerMapping] Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
[13:52:40] [ INFO ] [RequestMappingHandlerMapping] Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
[13:52:41] [ INFO ] [SimpleUrlHandlerMapping] Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
[13:52:41] [ INFO ] [SimpleUrlHandlerMapping] Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
[13:52:44] [ INFO ] [AnnotationMBeanExporter] Registering beans for JMX exposure on startup
[13:52:44] [ INFO ] [Http11NioProtocol] Starting ProtocolHandler ["http-nio-2333"]
[13:52:44] [ INFO ] [NioSelectorPool] Using a shared selector for servlet write/read
[13:52:45] [ INFO ] [TomcatWebServer] Tomcat started on port(s): 2333 (http) with context path ''
[13:52:45] [ INFO ] [Launcher] Started Launcher in 46.157 seconds (JVM running for 54.941)
[13:52:47] [ INFO ] [SocketServer] {"op": "voiceUpdate", "guildId": "183723585536393216", "sessionId": "a26769f9f7bc78f4de07a5fd9260e042", "event": {"token": "6fa5ac5bf60f5029", "guild_id": "183723585536393216", "endpoint": "eu-west438.discord.gg:80"}}
[13:52:47] [ INFO ] [JDAA] Audio System successfully setup!
[13:52:47] [ INFO ] [[/]] Initializing Spring FrameworkServlet 'dispatcherServlet'
[13:52:47] [ INFO ] [DispatcherServlet] FrameworkServlet 'dispatcherServlet': initialization started
[13:52:48] [ INFO ] [DispatcherServlet] FrameworkServlet 'dispatcherServlet': initialization completed in 231 ms
[13:52:48] [ INFO ] [SocketServer] {"op": "voiceUpdate", "guildId": "183723585536393216", "sessionId": "a26769f9f7bc78f4de07a5fd9260e042", "event": {"token": "6fa5ac5bf60f5029", "guild_id": "183723585536393216", "endpoint": "eu-west438.discord.gg:80"}}
[13:52:48] [ INFO ] [SocketServer] {"op": "voiceUpdate", "guildId": "183723585536393216", "sessionId": "a26769f9f7bc78f4de07a5fd9260e042", "event": {"token": "6fa5ac5bf60f5029", "guild_id": "183723585536393216", "endpoint": "eu-west438.discord.gg:80"}}
[13:52:48] [ INFO ] [SocketServer] {"op": "voiceUpdate", "guildId": "183723585536393216", "sessionId": "a26769f9f7bc78f4de07a5fd9260e042", "event": {"token": "6fa5ac5bf60f5029", "guild_id": "183723585536393216", "endpoint": "eu-west438.discord.gg:80"}}
[13:52:48] [ INFO ] [AudioLoaderRestHandler] GET /loadtracks
[13:52:54] [ INFO ] [AudioLoader] Loaded playlist Search results for: zomboy lone wolf
[13:52:54] [ INFO ] [SocketServer] {"op": "play", "guildId": "183723585536393216", "track": "QAAAewIAElpvbWJveSAtIExvbmUgV29sZgAPWm9tYm95IE9mZmljaWFsAAAAAAAD6+gAC3RkeldVRWpmZlE0AAEAK2h0dHBzOi8vd3d3LnlvdXR1YmUuY29tL3dhdGNoP3Y9dGR6V1VFamZmUTQAB3lvdXR1YmUAAAAAAAAAAA=="}
[13:53:00] [ INFO ] [SocketServer] {"op": "volume", "guildId": "183723585536393216", "volume": 50}
[13:53:36] [ INFO ] [SocketServer] {"op": "volume", "guildId": "183723585536393216", "volume": 100}
[13:56:56] [ ERROR] [LocalAudioTrackExecutor] Error in playback of tdzWUEjffQ4
com.sedmelluq.discord.lavaplayer.tools.FriendlyException: Something went wrong when decoding the track.
	at com.sedmelluq.discord.lavaplayer.tools.ExceptionTools.wrapUnfriendlyExceptions(ExceptionTools.java:43)
	at com.sedmelluq.discord.lavaplayer.track.playback.LocalAudioTrackExecutor.executeProcessingLoop(LocalAudioTrackExecutor.java:269)
	at com.sedmelluq.discord.lavaplayer.container.matroska.MatroskaAudioTrack.process(MatroskaAudioTrack.java:38)
	at com.sedmelluq.discord.lavaplayer.track.DelegatedAudioTrack.processDelegate(DelegatedAudioTrack.java:27)
	at com.sedmelluq.discord.lavaplayer.source.youtube.YoutubeAudioTrack.processStatic(YoutubeAudioTrack.java:75)
	at com.sedmelluq.discord.lavaplayer.source.youtube.YoutubeAudioTrack.process(YoutubeAudioTrack.java:67)
	at com.sedmelluq.discord.lavaplayer.track.playback.LocalAudioTrackExecutor.execute(LocalAudioTrackExecutor.java:90)
	at com.sedmelluq.discord.lavaplayer.player.DefaultAudioPlayerManager.lambda$executeTrack$1(DefaultAudioPlayerManager.java:348)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.RuntimeException: javax.net.ssl.SSLProtocolException: Connection reset
	at com.sedmelluq.discord.lavaplayer.container.matroska.MatroskaStreamingFile.provideFrames(MatroskaStreamingFile.java:309)
	at com.sedmelluq.discord.lavaplayer.container.matroska.MatroskaAudioTrack.lambda$process$0(MatroskaAudioTrack.java:39)
	at com.sedmelluq.discord.lavaplayer.track.playback.LocalAudioTrackExecutor.executeProcessingLoop(LocalAudioTrackExecutor.java:257)
	... 9 common frames omitted
Caused by: javax.net.ssl.SSLProtocolException: Connection reset
	at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:126)
	at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:321)
	at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:264)
	at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:259)
	at java.base/sun.security.ssl.SSLTransport.decode(SSLTransport.java:137)
	at java.base/sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1155)
	at java.base/sun.security.ssl.SSLSocketImpl.readApplicationRecord(SSLSocketImpl.java:1125)
	at java.base/sun.security.ssl.SSLSocketImpl$AppInputStream.read(SSLSocketImpl.java:823)
	at org.apache.http.impl.io.SessionInputBufferImpl.streamRead(SessionInputBufferImpl.java:137)
	at org.apache.http.impl.io.SessionInputBufferImpl.read(SessionInputBufferImpl.java:198)
	at org.apache.http.impl.io.ContentLengthInputStream.read(ContentLengthInputStream.java:176)
	at org.apache.http.conn.EofSensorInputStream.read(EofSensorInputStream.java:135)
	at java.base/java.io.BufferedInputStream.fill(BufferedInputStream.java:252)
	at java.base/java.io.BufferedInputStream.read1(BufferedInputStream.java:292)
	at java.base/java.io.BufferedInputStream.read(BufferedInputStream.java:351)
	at com.sedmelluq.discord.lavaplayer.tools.io.PersistentHttpStream.internalRead(PersistentHttpStream.java:172)
	at com.sedmelluq.discord.lavaplayer.tools.io.PersistentHttpStream.read(PersistentHttpStream.java:185)
	at java.base/java.io.DataInputStream.readFully(DataInputStream.java:200)
	at com.sedmelluq.discord.lavaplayer.container.matroska.format.MutableMatroskaBlock.getNextFrameBuffer(MutableMatroskaBlock.java:54)
	at com.sedmelluq.discord.lavaplayer.container.matroska.MatroskaStreamingFile.processFrameInBlock(MatroskaStreamingFile.java:372)
	at com.sedmelluq.discord.lavaplayer.container.matroska.MatroskaStreamingFile.parseClusterSimpleBlock(MatroskaStreamingFile.java:336)
	at com.sedmelluq.discord.lavaplayer.container.matroska.MatroskaStreamingFile.parseNextCluster(MatroskaStreamingFile.java:321)
	at com.sedmelluq.discord.lavaplayer.container.matroska.MatroskaStreamingFile.provideFrames(MatroskaStreamingFile.java:297)
	... 11 common frames omitted
Caused by: java.net.SocketException: Connection reset
	at java.base/java.net.SocketInputStream.read(SocketInputStream.java:186)
	at java.base/java.net.SocketInputStream.read(SocketInputStream.java:140)
	at java.base/sun.security.ssl.SSLSocketInputRecord.read(SSLSocketInputRecord.java:448)
	at java.base/sun.security.ssl.SSLSocketInputRecord.decodeInputRecord(SSLSocketInputRecord.java:237)
	at java.base/sun.security.ssl.SSLSocketInputRecord.decode(SSLSocketInputRecord.java:190)
	at java.base/sun.security.ssl.SSLTransport.decode(SSLTransport.java:108)
	... 29 common frames omitted
[13:56:56] [ INFO ] [SocketServer] {"op": "stop", "guildId": "183723585536393216"}
[13:57:31] [ INFO ] [AudioLoaderRestHandler] GET /loadtracks
[13:57:32] [ INFO ] [AudioLoader] Loaded playlist Search results for: zomboy lone wolf
[13:57:32] [ INFO ] [SocketServer] {"op": "play", "guildId": "183723585536393216", "track": "QAAAewIAElpvbWJveSAtIExvbmUgV29sZgAPWm9tYm95IE9mZmljaWFsAAAAAAAD6+gAC3RkeldVRWpmZlE0AAEAK2h0dHBzOi8vd3d3LnlvdXR1YmUuY29tL3dhdGNoP3Y9dGR6V1VFamZmUTQAB3lvdXR1YmUAAAAAAAAAAA=="}
[14:01:39] [ ERROR] [LocalAudioTrackExecutor] Error in playback of tdzWUEjffQ4
com.sedmelluq.discord.lavaplayer.tools.FriendlyException: Something went wrong when decoding the track.
	at com.sedmelluq.discord.lavaplayer.tools.ExceptionTools.wrapUnfriendlyExceptions(ExceptionTools.java:43)
	at com.sedmelluq.discord.lavaplayer.track.playback.LocalAudioTrackExecutor.executeProcessingLoop(LocalAudioTrackExecutor.java:269)
	at com.sedmelluq.discord.lavaplayer.container.matroska.MatroskaAudioTrack.process(MatroskaAudioTrack.java:38)
	at com.sedmelluq.discord.lavaplayer.track.DelegatedAudioTrack.processDelegate(DelegatedAudioTrack.java:27)
	at com.sedmelluq.discord.lavaplayer.source.youtube.YoutubeAudioTrack.processStatic(YoutubeAudioTrack.java:75)
	at com.sedmelluq.discord.lavaplayer.source.youtube.YoutubeAudioTrack.process(YoutubeAudioTrack.java:67)
	at com.sedmelluq.discord.lavaplayer.track.playback.LocalAudioTrackExecutor.execute(LocalAudioTrackExecutor.java:90)
	at com.sedmelluq.discord.lavaplayer.player.DefaultAudioPlayerManager.lambda$executeTrack$1(DefaultAudioPlayerManager.java:348)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.RuntimeException: javax.net.ssl.SSLProtocolException: Connection reset
	at com.sedmelluq.discord.lavaplayer.container.matroska.MatroskaStreamingFile.provideFrames(MatroskaStreamingFile.java:309)
	at com.sedmelluq.discord.lavaplayer.container.matroska.MatroskaAudioTrack.lambda$process$0(MatroskaAudioTrack.java:39)
	at com.sedmelluq.discord.lavaplayer.track.playback.LocalAudioTrackExecutor.executeProcessingLoop(LocalAudioTrackExecutor.java:257)
	... 9 common frames omitted
Caused by: javax.net.ssl.SSLProtocolException: Connection reset
	at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:126)
	at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:321)
	at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:264)
	at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:259)
	at java.base/sun.security.ssl.SSLTransport.decode(SSLTransport.java:137)
	at java.base/sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1155)
	at java.base/sun.security.ssl.SSLSocketImpl.readApplicationRecord(SSLSocketImpl.java:1125)
	at java.base/sun.security.ssl.SSLSocketImpl$AppInputStream.read(SSLSocketImpl.java:823)
	at org.apache.http.impl.io.SessionInputBufferImpl.streamRead(SessionInputBufferImpl.java:137)
	at org.apache.http.impl.io.SessionInputBufferImpl.read(SessionInputBufferImpl.java:198)
	at org.apache.http.impl.io.ContentLengthInputStream.read(ContentLengthInputStream.java:176)
	at org.apache.http.conn.EofSensorInputStream.read(EofSensorInputStream.java:135)
	at java.base/java.io.BufferedInputStream.fill(BufferedInputStream.java:252)
	at java.base/java.io.BufferedInputStream.read1(BufferedInputStream.java:292)
	at java.base/java.io.BufferedInputStream.read(BufferedInputStream.java:351)
	at com.sedmelluq.discord.lavaplayer.tools.io.PersistentHttpStream.internalRead(PersistentHttpStream.java:172)
	at com.sedmelluq.discord.lavaplayer.tools.io.PersistentHttpStream.read(PersistentHttpStream.java:185)
	at java.base/java.io.DataInputStream.readFully(DataInputStream.java:200)
	at com.sedmelluq.discord.lavaplayer.container.matroska.format.MutableMatroskaBlock.getNextFrameBuffer(MutableMatroskaBlock.java:54)
	at com.sedmelluq.discord.lavaplayer.container.matroska.MatroskaStreamingFile.processFrameInBlock(MatroskaStreamingFile.java:372)
	at com.sedmelluq.discord.lavaplayer.container.matroska.MatroskaStreamingFile.parseClusterSimpleBlock(MatroskaStreamingFile.java:336)
	at com.sedmelluq.discord.lavaplayer.container.matroska.MatroskaStreamingFile.parseNextCluster(MatroskaStreamingFile.java:321)
	at com.sedmelluq.discord.lavaplayer.container.matroska.MatroskaStreamingFile.provideFrames(MatroskaStreamingFile.java:297)
	... 11 common frames omitted
Caused by: java.net.SocketException: Connection reset
	at java.base/java.net.SocketInputStream.read(SocketInputStream.java:186)
	at java.base/java.net.SocketInputStream.read(SocketInputStream.java:140)
	at java.base/sun.security.ssl.SSLSocketInputRecord.read(SSLSocketInputRecord.java:448)
	at java.base/sun.security.ssl.SSLSocketInputRecord.decodeInputRecord(SSLSocketInputRecord.java:237)
	at java.base/sun.security.ssl.SSLSocketInputRecord.decode(SSLSocketInputRecord.java:190)
	at java.base/sun.security.ssl.SSLTransport.decode(SSLTransport.java:108)
	... 29 common frames omitted
[14:01:40] [ INFO ] [SocketServer] {"op": "stop", "guildId": "183723585536393216"}
[14:02:55] [ INFO ] [AudioLoaderRestHandler] GET /loadtracks
[14:02:56] [ INFO ] [AudioLoader] Loaded playlist Search results for: hype music
[14:02:56] [ INFO ] [SocketServer] {"op": "play", "guildId": "183723585536393216", "track": "QAAAqwIAQkh5cGUgVHJhcCBNdXNpYyBNaXggfCBCZXN0IG9mIFN1bW1lciAyMDE1IHwgWyAxIEhvdXIgXSBvZiBJbnNhbml0eQAPT2ZmaWNpYWxTaGVsbFp6AAAAAABBTsAAC0F0SlFLQ01BT1k4AAEAK2h0dHBzOi8vd3d3LnlvdXR1YmUuY29tL3dhdGNoP3Y9QXRKUUtDTUFPWTgAB3lvdXR1YmUAAAAAAAAAAA=="}
```

System information:
**Linux pebble 4.20.6-1-ARCH #1 SMP PREEMPT Fri Feb 8 02:30:15 UTC 2019 armv7l GNU/Linux**
packages fully updated as the time of this report
running Orange PI PC Plus




Discussion:
Hi @dafzor, it looks like your architecture is fairly unique which probably means you require a modified Lavalink.jar for the server to run properly. @aikaterna tells me you've made modifications to the Lavalink.jar yourself - please note that if you're using internal Lavalink and replace the internal Lavalink.jar, then after updating Red, the Lavalink.jar will be re-downloaded and will replace the internal jar you modified.
While that is the case the stock lavalink.jar still runs and function as
long as volume is left at 100% (the modification adds the native arm lib
required for it to work).

So the issue reported here is not due to that. Has I said I'm using the
same lavalink.jar when starting it as an external server and it starts
normally.

On Mon, 18 Feb 2019, 00:27 Toby Harradine <notifications@github.com wrote:

> Hi @dafzor <https://github.com/dafzor>, it looks like your architecture
> is fairly unique which probably means you require a modified Lavalink.jar
> for the server to run properly. @aikaterna <https://github.com/aikaterna>
> tells me you've made modifications to the Lavalink.jar yourself - please
> note that if you're using internal Lavalink and replace the internal
> Lavalink.jar, then after updating Red, the Lavalink.jar will be
> re-downloaded and will replace the internal jar you modified.
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <https://github.com/Cog-Creators/Red-DiscordBot/issues/2463#issuecomment-464534070>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/ABiZrlgWlCVBFejVi3-JB8icPVidMDNdks5vOfNhgaJpZM4a_k9P>
> .
>

@dafzor Looking at your logfile for the internal Lavalink, it seems as though the server is restarting at almost exactly 30 second intervals. To me this indicates some kind of timeout error. Are you able to provide any accompanying logs from Red? It might also be helpful if you start the bot with the `--debug` flag.
Did as requested and bellow is the redbot log, all seems to indicate that it tries to connect before it's fully started and when it fails it just restarts the lavalink server thinking it's "unresponsive"?

```
Feb 18 19:52:22 pebble systemd[1]: Started Red-DiscordBot.
Feb 18 19:52:29 pebble redbot[17762]: [18/02/2019 19:52] DEBUG json_io _load_json 83: Reading file /home/daf/butler/core/settings.json
Feb 18 19:52:29 pebble redbot[17762]: [18/02/2019 19:52] DEBUG config get_conf 572: Basic config:
Feb 18 19:52:29 pebble redbot[17762]: {'COG_PATH_APPEND': 'cogs', 'CORE_PATH_APPEND': 'core', 'DATA_PATH': '/home/daf/butler', 'STORAGE_DETAILS': {}, 'STORAGE_TYPE': 'JSON'}
Feb 18 19:52:29 pebble redbot[17762]: [18/02/2019 19:52] DEBUG config get_conf 577: Using driver: 'JSON'
Feb 18 19:52:29 pebble redbot[17762]: [18/02/2019 19:52] DEBUG json_io _load_json 83: Reading file /home/daf/butler/cogs/CogManager/settings.json
Feb 18 19:52:30 pebble redbot[17762]: Connected to Discord. Getting ready...
Feb 18 19:52:32 pebble redbot[17762]: Loading packages...
Feb 18 19:52:32 pebble redbot[17762]: [18/02/2019 19:52] DEBUG config get_conf 572: Basic config:
Feb 18 19:52:32 pebble redbot[17762]: {'COG_PATH_APPEND': 'cogs', 'CORE_PATH_APPEND': 'core', 'DATA_PATH': '/home/daf/butler', 'STORAGE_DETAILS': {}, 'STORAGE_TYPE': 'JSON'}
Feb 18 19:52:32 pebble redbot[17762]: [18/02/2019 19:52] DEBUG config get_conf 577: Using driver: 'JSON'
Feb 18 19:52:32 pebble redbot[17762]: [18/02/2019 19:52] DEBUG json_io _load_json 83: Reading file /home/daf/butler/cogs/Permissions/settings.json
Feb 18 19:52:32 pebble redbot[17762]: [18/02/2019 19:52] DEBUG config get_conf 572: Basic config:
Feb 18 19:52:32 pebble redbot[17762]: {'COG_PATH_APPEND': 'cogs', 'CORE_PATH_APPEND': 'core', 'DATA_PATH': '/home/daf/butler', 'STORAGE_DETAILS': {}, 'STORAGE_TYPE': 'JSON'}
Feb 18 19:52:32 pebble redbot[17762]: [18/02/2019 19:52] DEBUG config get_conf 577: Using driver: 'JSON'
Feb 18 19:52:32 pebble redbot[17762]: [18/02/2019 19:52] DEBUG json_io _load_json 83: Reading file /home/daf/butler/cogs/CustomCommands/settings.json
Feb 18 19:52:32 pebble redbot[17762]: [18/02/2019 19:52] DEBUG config get_conf 572: Basic config:
Feb 18 19:52:32 pebble redbot[17762]: {'COG_PATH_APPEND': 'cogs', 'CORE_PATH_APPEND': 'core', 'DATA_PATH': '/home/daf/butler', 'STORAGE_DETAILS': {}, 'STORAGE_TYPE': 'JSON'}
Feb 18 19:52:32 pebble redbot[17762]: [18/02/2019 19:52] DEBUG config get_conf 577: Using driver: 'JSON'
Feb 18 19:52:32 pebble redbot[17762]: [18/02/2019 19:52] DEBUG json_io _load_json 83: Reading file /home/daf/butler/cogs/Downloader/settings.json
Feb 18 19:52:34 pebble redbot[17762]: [18/02/2019 19:52] DEBUG config get_conf 572: Basic config:
Feb 18 19:52:34 pebble redbot[17762]: {'COG_PATH_APPEND': 'cogs', 'CORE_PATH_APPEND': 'core', 'DATA_PATH': '/home/daf/butler', 'STORAGE_DETAILS': {}, 'STORAGE_TYPE': 'JSON'}
Feb 18 19:52:34 pebble redbot[17762]: [18/02/2019 19:52] DEBUG config get_conf 577: Using driver: 'JSON'
Feb 18 19:52:34 pebble redbot[17762]: [18/02/2019 19:52] DEBUG json_io _load_json 83: Reading file /home/daf/butler/cogs/Image/settings.json
Feb 18 19:52:34 pebble redbot[17762]: [18/02/2019 19:52] DEBUG config get_conf 572: Basic config:
Feb 18 19:52:34 pebble redbot[17762]: {'COG_PATH_APPEND': 'cogs', 'CORE_PATH_APPEND': 'core', 'DATA_PATH': '/home/daf/butler', 'STORAGE_DETAILS': {}, 'STORAGE_TYPE': 'JSON'}
Feb 18 19:52:34 pebble redbot[17762]: [18/02/2019 19:52] DEBUG config get_conf 577: Using driver: 'JSON'
Feb 18 19:52:34 pebble redbot[17762]: [18/02/2019 19:52] DEBUG json_io _load_json 83: Reading file /home/daf/butler/cogs/Alias/settings.json
Feb 18 19:52:34 pebble redbot[17762]: [18/02/2019 19:52] DEBUG config get_conf 572: Basic config:
Feb 18 19:52:34 pebble redbot[17762]: {'COG_PATH_APPEND': 'cogs', 'CORE_PATH_APPEND': 'core', 'DATA_PATH': '/home/daf/butler', 'STORAGE_DETAILS': {}, 'STORAGE_TYPE': 'JSON'}
Feb 18 19:52:34 pebble redbot[17762]: [18/02/2019 19:52] DEBUG config get_conf 577: Using driver: 'JSON'
Feb 18 19:52:34 pebble redbot[17762]: [18/02/2019 19:52] DEBUG json_io _load_json 83: Reading file /home/daf/butler/cogs/Bank/settings.json
Feb 18 19:52:34 pebble redbot[17762]: [18/02/2019 19:52] DEBUG config get_conf 572: Basic config:
Feb 18 19:52:34 pebble redbot[17762]: {'COG_PATH_APPEND': 'cogs', 'CORE_PATH_APPEND': 'core', 'DATA_PATH': '/home/daf/butler', 'STORAGE_DETAILS': {}, 'STORAGE_TYPE': 'JSON'}
Feb 18 19:52:34 pebble redbot[17762]: [18/02/2019 19:52] DEBUG config get_conf 577: Using driver: 'JSON'
Feb 18 19:52:34 pebble redbot[17762]: [18/02/2019 19:52] DEBUG json_io _load_json 83: Reading file /home/daf/butler/cogs/Trivia/settings.json
Feb 18 19:52:34 pebble redbot[17762]: [18/02/2019 19:52] DEBUG config get_conf 572: Basic config:
Feb 18 19:52:34 pebble redbot[17762]: {'COG_PATH_APPEND': 'cogs', 'CORE_PATH_APPEND': 'core', 'DATA_PATH': '/home/daf/butler', 'STORAGE_DETAILS': {}, 'STORAGE_TYPE': 'JSON'}
Feb 18 19:52:34 pebble redbot[17762]: [18/02/2019 19:52] DEBUG config get_conf 577: Using driver: 'JSON'
Feb 18 19:52:34 pebble redbot[17762]: [18/02/2019 19:52] DEBUG json_io _load_json 83: Reading file /home/daf/butler/cogs/Admin/settings.json
Feb 18 19:52:34 pebble redbot[17762]: [18/02/2019 19:52] DEBUG config get_conf 572: Basic config:
Feb 18 19:52:34 pebble redbot[17762]: {'COG_PATH_APPEND': 'cogs', 'CORE_PATH_APPEND': 'core', 'DATA_PATH': '/home/daf/butler', 'STORAGE_DETAILS': {}, 'STORAGE_TYPE': 'JSON'}
Feb 18 19:52:34 pebble redbot[17762]: [18/02/2019 19:52] DEBUG config get_conf 577: Using driver: 'JSON'
Feb 18 19:52:34 pebble redbot[17762]: [18/02/2019 19:52] DEBUG json_io _load_json 83: Reading file /home/daf/butler/cogs/Streams/settings.json
Feb 18 19:52:34 pebble redbot[17762]: [18/02/2019 19:52] DEBUG config get_conf 572: Basic config:
Feb 18 19:52:34 pebble redbot[17762]: {'COG_PATH_APPEND': 'cogs', 'CORE_PATH_APPEND': 'core', 'DATA_PATH': '/home/daf/butler', 'STORAGE_DETAILS': {}, 'STORAGE_TYPE': 'JSON'}
Feb 18 19:52:34 pebble redbot[17762]: [18/02/2019 19:52] DEBUG config get_conf 577: Using driver: 'JSON'
Feb 18 19:52:34 pebble redbot[17762]: [18/02/2019 19:52] DEBUG json_io _load_json 83: Reading file /home/daf/butler/cogs/Currency/settings.json
Feb 18 19:52:34 pebble redbot[17762]: [18/02/2019 19:52] DEBUG config get_conf 572: Basic config:
Feb 18 19:52:34 pebble redbot[17762]: {'COG_PATH_APPEND': 'cogs', 'CORE_PATH_APPEND': 'core', 'DATA_PATH': '/home/daf/butler', 'STORAGE_DETAILS': {}, 'STORAGE_TYPE': 'JSON'}
Feb 18 19:52:34 pebble redbot[17762]: [18/02/2019 19:52] DEBUG config get_conf 577: Using driver: 'JSON'
Feb 18 19:52:34 pebble redbot[17762]: [18/02/2019 19:52] DEBUG json_io _load_json 83: Reading file /home/daf/butler/cogs/ReactPoll/settings.json
Feb 18 19:52:34 pebble redbot[17762]: [18/02/2019 19:52] DEBUG config get_conf 572: Basic config:
Feb 18 19:52:34 pebble redbot[17762]: {'COG_PATH_APPEND': 'cogs', 'CORE_PATH_APPEND': 'core', 'DATA_PATH': '/home/daf/butler', 'STORAGE_DETAILS': {}, 'STORAGE_TYPE': 'JSON'}
Feb 18 19:52:34 pebble redbot[17762]: [18/02/2019 19:52] DEBUG config get_conf 577: Using driver: 'JSON'
Feb 18 19:52:34 pebble redbot[17762]: [18/02/2019 19:52] DEBUG json_io _load_json 83: Reading file /home/daf/butler/cogs/Tweets/settings.json
Feb 18 19:52:34 pebble redbot[17762]: [18/02/2019 19:52] DEBUG config get_conf 572: Basic config:
Feb 18 19:52:34 pebble redbot[17762]: {'COG_PATH_APPEND': 'cogs', 'CORE_PATH_APPEND': 'core', 'DATA_PATH': '/home/daf/butler', 'STORAGE_DETAILS': {}, 'STORAGE_TYPE': 'JSON'}
Feb 18 19:52:34 pebble redbot[17762]: [18/02/2019 19:52] DEBUG config get_conf 577: Using driver: 'JSON'
Feb 18 19:52:34 pebble redbot[17762]: [18/02/2019 19:52] DEBUG json_io _load_json 83: Reading file /home/daf/butler/cogs/OboobsC/settings.json
Feb 18 19:52:34 pebble redbot[17762]: [18/02/2019 19:52] DEBUG config get_conf 572: Basic config:
Feb 18 19:52:34 pebble redbot[17762]: {'COG_PATH_APPEND': 'cogs', 'CORE_PATH_APPEND': 'core', 'DATA_PATH': '/home/daf/butler', 'STORAGE_DETAILS': {}, 'STORAGE_TYPE': 'JSON'}
Feb 18 19:52:34 pebble redbot[17762]: [18/02/2019 19:52] DEBUG config get_conf 577: Using driver: 'JSON'
Feb 18 19:52:34 pebble redbot[17762]: [18/02/2019 19:52] DEBUG json_io _load_json 83: Reading file /home/daf/butler/cogs/EventMaker/settings.json
Feb 18 19:52:35 pebble redbot[17762]: [18/02/2019 19:52] DEBUG config get_conf 572: Basic config:
Feb 18 19:52:35 pebble redbot[17762]: {'COG_PATH_APPEND': 'cogs', 'CORE_PATH_APPEND': 'core', 'DATA_PATH': '/home/daf/butler', 'STORAGE_DETAILS': {}, 'STORAGE_TYPE': 'JSON'}
Feb 18 19:52:35 pebble redbot[17762]: [18/02/2019 19:52] DEBUG config get_conf 577: Using driver: 'JSON'
Feb 18 19:52:35 pebble redbot[17762]: [18/02/2019 19:52] DEBUG json_io _load_json 83: Reading file /home/daf/butler/cogs/Audio/settings.json
Feb 18 19:52:35 pebble redbot[17762]: [18/02/2019 19:52] DEBUG json_io _save_json 50: Saving file /home/daf/butler/cogs/ReactPoll/settings.json
Feb 18 19:52:35 pebble redbot[17762]: [18/02/2019 19:52] INFO manager start_lavalink_server 126: Lavalink jar started. PID: 17830
Feb 18 19:52:35 pebble redbot[17762]: Loaded packages: permissions, customcom, downloader, image, alias, trivia, general, admin, streams, rolemembers, droll, currency, reactpoll, tweets, oboobs, eventmaker, audio
Feb 18 19:52:35 pebble redbot[17762]: [18/02/2019 19:52] INFO manager shutdown_lavalink_server 136: Shutting down lavalink server.
Feb 18 19:52:36 pebble redbot[17762]: Task exception was never retrieved
Feb 18 19:52:36 pebble redbot[17762]: future: <Task finished coro=<monitor_lavalink_server() done, defined at /home/daf/.local/lib/python3.7/site-packages/redbot/cogs/audio/manager.py:30> exception=AttributeError("'NoneType' object has no attribute 'poll'")>
Feb 18 19:52:36 pebble redbot[17762]: Traceback (most recent call last):
Feb 18 19:52:36 pebble redbot[17762]:   File "/home/daf/.local/lib/python3.7/site-packages/redbot/cogs/audio/manager.py", line 32, in monitor_lavalink_server
Feb 18 19:52:36 pebble redbot[17762]:     if proc.poll() is not None:
Feb 18 19:52:36 pebble redbot[17762]: AttributeError: 'NoneType' object has no attribute 'poll'
Feb 18 19:52:36 pebble redbot[17762]: [18/02/2019 19:52] INFO manager start_lavalink_server 126: Lavalink jar started. PID: 17843
Feb 18 19:52:36 pebble redbot[17762]: [18/02/2019 19:52] DEBUG node connect 192: Lavalink WS connecting to ws://localhost:2333 or ws://localhost:2332 with headers {'Authorization': 'youshallnotpass', 'User-Id': 429449238280405013, 'Num-Shards': 1}
Feb 18 19:52:36 pebble redbot[17762]: [18/02/2019 19:52] DEBUG node _multi_try_connect 236: Failed connect attempt 1, retrying in 1.704282818653991
Feb 18 19:52:36 pebble redbot[17762]: [18/02/2019 19:52] DEBUG node _multi_try_connect 236: Failed connect attempt 1, retrying in 0.5403186779391012
Feb 18 19:52:37 pebble redbot[17762]: [18/02/2019 19:52] DEBUG node _multi_try_connect 236: Failed connect attempt 2, retrying in 2.237040242766253
Feb 18 19:52:37 pebble redbot[17762]: ______         _           ______ _                       _  ______       _
Feb 18 19:52:37 pebble redbot[17762]: | ___ \       | |          |  _  (_)                     | | | ___ \     | |
Feb 18 19:52:37 pebble redbot[17762]: | |_/ /___  __| |  ______  | | | |_ ___  ___ ___  _ __ __| | | |_/ / ___ | |_
Feb 18 19:52:37 pebble redbot[17762]: |    // _ \/ _` | |______| | | | | / __|/ __/ _ \| '__/ _` | | ___ \/ _ \| __|
Feb 18 19:52:37 pebble redbot[17762]: | |\ \  __/ (_| |          | |/ /| \__ \ (_| (_) | | | (_| | | |_/ / (_) | |_
Feb 18 19:52:37 pebble redbot[17762]: \_| \_\___|\__,_|          |___/ |_|___/\___\___/|_|  \__,_| \____/ \___/ \__|
Feb 18 19:52:37 pebble redbot[17762]: ┌───────────────────────────────────┐    ┌──────────────────────────┐
Feb 18 19:52:37 pebble redbot[17762]: │butler#9025                        │    │X Error Reporting         │
Feb 18 19:52:37 pebble redbot[17762]: │Prefixes: .                        │    │X MongoDB                 │
Feb 18 19:52:37 pebble redbot[17762]: │Language: en                       │    │√ Voice                   │
Feb 18 19:52:37 pebble redbot[17762]: │Red Bot Version: 3.0.1             │    │X Docs                    │
Feb 18 19:52:37 pebble redbot[17762]: │Discord.py Version: 1.0.0a         │    │X Tests                   │
Feb 18 19:52:37 pebble redbot[17762]: │Shards: 1                          │    └──────────────────────────┘
Feb 18 19:52:37 pebble redbot[17762]: │Servers: 1                         │
Feb 18 19:52:37 pebble redbot[17762]: │Users: 12                          │
Feb 18 19:52:37 pebble redbot[17762]: │19 cogs with 103 commands          │
Feb 18 19:52:37 pebble redbot[17762]: └───────────────────────────────────┘
Feb 18 19:52:37 pebble redbot[17762]: Invite URL: https://discordapp.com/oauth2/authorize?client_id=<redacted>&scope=bot
Feb 18 19:52:38 pebble redbot[17762]: [18/02/2019 19:52] DEBUG node _multi_try_connect 236: Failed connect attempt 2, retrying in 3.830107501966753
Feb 18 19:52:39 pebble redbot[17762]: [18/02/2019 19:52] DEBUG node _multi_try_connect 236: Failed connect attempt 3, retrying in 7.870037410162463
Feb 18 19:52:42 pebble redbot[17762]: [18/02/2019 19:52] DEBUG node _multi_try_connect 236: Failed connect attempt 3, retrying in 2.5612946955698126
Feb 18 19:52:44 pebble redbot[17762]: [18/02/2019 19:52] DEBUG node _multi_try_connect 236: Failed connect attempt 4, retrying in 10.116771176486495
Feb 18 19:52:47 pebble redbot[17762]: [18/02/2019 19:52] DEBUG node _multi_try_connect 236: Failed connect attempt 4, retrying in 9.626989285486214
Feb 18 19:52:54 pebble redbot[17762]: [18/02/2019 19:52] DEBUG node _multi_try_connect 236: Failed connect attempt 5, retrying in 16.67042220499931
Feb 18 19:52:56 pebble redbot[17762]: [18/02/2019 19:52] DEBUG node _multi_try_connect 236: Failed connect attempt 5, retrying in 12.104663348412213
Feb 18 19:53:06 pebble redbot[17762]: [18/02/2019 19:53] INFO manager shutdown_lavalink_server 136: Shutting down lavalink server.
Feb 18 19:53:06 pebble redbot[17762]: Task exception was never retrieved
Feb 18 19:53:06 pebble redbot[17762]: future: <Task finished coro=<monitor_lavalink_server() done, defined at /home/daf/.local/lib/python3.7/site-packages/redbot/cogs/audio/manager.py:30> exception=AttributeError("'NoneType' object has no attribute 'poll'")>
Feb 18 19:53:06 pebble redbot[17762]: Traceback (most recent call last):
Feb 18 19:53:06 pebble redbot[17762]:   File "/home/daf/.local/lib/python3.7/site-packages/redbot/cogs/audio/manager.py", line 32, in monitor_lavalink_server
Feb 18 19:53:06 pebble redbot[17762]:     if proc.poll() is not None:
Feb 18 19:53:06 pebble redbot[17762]: AttributeError: 'NoneType' object has no attribute 'poll'
Feb 18 19:53:08 pebble redbot[17762]: [18/02/2019 19:53] INFO manager start_lavalink_server 126: Lavalink jar started. PID: 17886
Feb 18 19:53:08 pebble redbot[17762]: [18/02/2019 19:53] DEBUG node connect 192: Lavalink WS connecting to ws://localhost:2333 or ws://localhost:2332 with headers {'Authorization': 'youshallnotpass', 'User-Id': 429449238280405013, 'Num-Shards': 1}
Feb 18 19:53:08 pebble redbot[17762]: [18/02/2019 19:53] DEBUG node _multi_try_connect 236: Failed connect attempt 1, retrying in 1.029424664739015
Feb 18 19:53:08 pebble redbot[17762]: [18/02/2019 19:53] DEBUG node _multi_try_connect 236: Failed connect attempt 1, retrying in 1.3531865409899526
Feb 18 19:53:09 pebble redbot[17762]: [18/02/2019 19:53] DEBUG node _multi_try_connect 236: Failed connect attempt 6, retrying in 13.007768553948175
Feb 18 19:53:09 pebble redbot[17762]: [18/02/2019 19:53] DEBUG node _multi_try_connect 236: Failed connect attempt 2, retrying in 3.119662806628245
Feb 18 19:53:09 pebble redbot[17762]: [18/02/2019 19:53] DEBUG node _multi_try_connect 236: Failed connect attempt 2, retrying in 0.9943716017190543
Feb 18 19:53:10 pebble redbot[17762]: [18/02/2019 19:53] DEBUG node _multi_try_connect 236: Failed connect attempt 3, retrying in 1.109355507213233
Feb 18 19:53:11 pebble redbot[17762]: [18/02/2019 19:53] DEBUG node _multi_try_connect 236: Failed connect attempt 6, retrying in 40.68895225053265
Feb 18 19:53:11 pebble redbot[17762]: [18/02/2019 19:53] DEBUG node _multi_try_connect 236: Failed connect attempt 4, retrying in 12.030944249545211
Feb 18 19:53:12 pebble redbot[17762]: [18/02/2019 19:53] DEBUG node _multi_try_connect 236: Failed connect attempt 3, retrying in 0.3607774828031287
Feb 18 19:53:12 pebble redbot[17762]: [18/02/2019 19:53] DEBUG node _multi_try_connect 236: Failed connect attempt 4, retrying in 3.17321123420866
Feb 18 19:53:15 pebble redbot[17762]: [18/02/2019 19:53] DEBUG node _multi_try_connect 236: Failed connect attempt 5, retrying in 5.337617922959847
Feb 18 19:53:21 pebble redbot[17762]: [18/02/2019 19:53] DEBUG node _multi_try_connect 236: Failed connect attempt 6, retrying in 50.14370838804984
Feb 18 19:53:22 pebble redbot[17762]: [18/02/2019 19:53] DEBUG node _multi_try_connect 236: Failed connect attempt 7, retrying in 51.68293651711248
Feb 18 19:53:23 pebble redbot[17762]: [18/02/2019 19:53] DEBUG node _multi_try_connect 236: Failed connect attempt 5, retrying in 25.04974598014297
Feb 18 19:53:38 pebble redbot[17762]: [18/02/2019 19:53] INFO manager shutdown_lavalink_server 136: Shutting down lavalink server.
Feb 18 19:53:38 pebble redbot[17762]: Task exception was never retrieved
Feb 18 19:53:38 pebble redbot[17762]: future: <Task finished coro=<monitor_lavalink_server() done, defined at /home/daf/.local/lib/python3.7/site-packages/redbot/cogs/audio/manager.py:30> exception=AttributeError("'NoneType' object has no attribute 'poll'")>
Feb 18 19:53:38 pebble redbot[17762]: Traceback (most recent call last):
Feb 18 19:53:38 pebble redbot[17762]:   File "/home/daf/.local/lib/python3.7/site-packages/redbot/cogs/audio/manager.py", line 32, in monitor_lavalink_server
Feb 18 19:53:38 pebble redbot[17762]:     if proc.poll() is not None:
Feb 18 19:53:38 pebble redbot[17762]: AttributeError: 'NoneType' object has no attribute 'poll'
Feb 18 19:53:39 pebble redbot[17762]: [18/02/2019 19:53] INFO manager start_lavalink_server 126: Lavalink jar started. PID: 17923
Feb 18 19:53:39 pebble redbot[17762]: [18/02/2019 19:53] DEBUG node connect 192: Lavalink WS connecting to ws://localhost:2333 or ws://localhost:2332 with headers {'Authorization': 'youshallnotpass', 'User-Id': 429449238280405013, 'Num-Shards': 1}
Feb 18 19:53:39 pebble redbot[17762]: [18/02/2019 19:53] DEBUG node _multi_try_connect 236: Failed connect attempt 1, retrying in 0.01087135645787951
Feb 18 19:53:39 pebble redbot[17762]: [18/02/2019 19:53] DEBUG node _multi_try_connect 236: Failed connect attempt 1, retrying in 0.4997286759531765
Feb 18 19:53:39 pebble redbot[17762]: [18/02/2019 19:53] DEBUG node _multi_try_connect 236: Failed connect attempt 2, retrying in 2.9407129501177414
Feb 18 19:53:40 pebble redbot[17762]: [18/02/2019 19:53] DEBUG node _multi_try_connect 236: Failed connect attempt 2, retrying in 2.6967577630397286
Feb 18 19:53:42 pebble redbot[17762]: [18/02/2019 19:53] DEBUG node _multi_try_connect 236: Failed connect attempt 3, retrying in 0.13527025940002524
Feb 18 19:53:43 pebble redbot[17762]: [18/02/2019 19:53] DEBUG node _multi_try_connect 236: Failed connect attempt 4, retrying in 3.0842300795657973
Feb 18 19:53:43 pebble redbot[17762]: [18/02/2019 19:53] DEBUG node _multi_try_connect 236: Failed connect attempt 3, retrying in 5.344690419801022
Feb 18 19:53:45 pebble systemd[1]: Stopping Red-DiscordBot...
Feb 18 19:53:45 pebble systemd[1]: red.service: Main process exited, code=killed, status=15/TERM
Feb 18 19:53:45 pebble systemd[1]: red.service: Succeeded.
Feb 18 19:53:45 pebble systemd[1]: Stopped Red-DiscordBot.
```
@dafzor Thanks for the extra info. Indeed, it's likely due to limited resource availability (whether from your hardware, or other processes) that the server takes longer than 30 seconds to start up, causing the connect task to timeout and raise an exception. I'll note that the timeout error ought to be logged in the console.

We're thinking of making the server subprocess manager wait for the lavalink server to be ready by piping and parsing stdout, rather than just retrying the connection until it either succeeds or times out.

Thanks for bringing this to the attention of the devs.

Resolving patch:
diff --git a/redbot/cogs/audio/__init__.py b/redbot/cogs/audio/__init__.py
--- a/redbot/cogs/audio/__init__.py
+++ b/redbot/cogs/audio/__init__.py
@@ -1,31 +1,9 @@
-from pathlib import Path
-import logging
-
-from .audio import Audio
-from .manager import start_lavalink_server, maybe_download_lavalink
 from redbot.core import commands
-from redbot.core.data_manager import cog_data_path
-import redbot.core
-
-log = logging.getLogger("red.audio")
-
-LAVALINK_DOWNLOAD_URL = (
-    "https://github.com/Cog-Creators/Red-DiscordBot/releases/download/{}/Lavalink.jar"
-).format(redbot.core.__version__)
 
-LAVALINK_DOWNLOAD_DIR = cog_data_path(raw_name="Audio")
-LAVALINK_JAR_FILE = LAVALINK_DOWNLOAD_DIR / "Lavalink.jar"
-
-APP_YML_FILE = LAVALINK_DOWNLOAD_DIR / "application.yml"
-BUNDLED_APP_YML_FILE = Path(__file__).parent / "data/application.yml"
+from .audio import Audio
 
 
 async def setup(bot: commands.Bot):
     cog = Audio(bot)
-    if not await cog.config.use_external_lavalink():
-        await maybe_download_lavalink(bot.loop, cog)
-        await start_lavalink_server(bot.loop)
-
     await cog.initialize()
-
     bot.add_cog(cog)
diff --git a/redbot/cogs/audio/audio.py b/redbot/cogs/audio/audio.py
--- a/redbot/cogs/audio/audio.py
+++ b/redbot/cogs/audio/audio.py
@@ -14,6 +14,7 @@
 import random
 import re
 import time
+from typing import Optional
 import redbot.core
 from redbot.core import Config, commands, checks, bank
 from redbot.core.data_manager import cog_data_path
@@ -29,7 +30,7 @@
 )
 from redbot.core.utils.predicates import MessagePredicate, ReactionPredicate
 from urllib.parse import urlparse
-from .manager import shutdown_lavalink_server, start_lavalink_server, maybe_download_lavalink
+from .manager import ServerManager
 
 _ = Translator("Audio", __file__)
 
@@ -43,41 +44,45 @@
 class Audio(commands.Cog):
     """Play audio through voice channels."""
 
+    _default_lavalink_settings = {
+        "host": "localhost",
+        "rest_port": 2333,
+        "ws_port": 2333,
+        "password": "youshallnotpass",
+    }
+
     def __init__(self, bot):
         super().__init__()
         self.bot = bot
         self.config = Config.get_conf(self, 2711759130, force_registration=True)
 
-        default_global = {
-            "host": "localhost",
-            "rest_port": "2333",
-            "ws_port": "2332",
-            "password": "youshallnotpass",
-            "status": False,
-            "current_version": redbot.core.VersionInfo.from_str("3.0.0a0").to_json(),
-            "use_external_lavalink": False,
-            "restrict": True,
-            "localpath": str(cog_data_path(raw_name="Audio")),
-        }
+        default_global = dict(
+            status=False,
+            use_external_lavalink=False,
+            restrict=True,
+            current_version=redbot.core.VersionInfo.from_str("3.0.0a0").to_json(),
+            localpath=str(cog_data_path(raw_name="Audio")),
+            **self._default_lavalink_settings,
+        )
 
-        default_guild = {
-            "disconnect": False,
-            "dj_enabled": False,
-            "dj_role": None,
-            "emptydc_enabled": False,
-            "emptydc_timer": 0,
-            "jukebox": False,
-            "jukebox_price": 0,
-            "maxlength": 0,
-            "playlists": {},
-            "notify": False,
-            "repeat": False,
-            "shuffle": False,
-            "thumbnail": False,
-            "volume": 100,
-            "vote_enabled": False,
-            "vote_percent": 0,
-        }
+        default_guild = dict(
+            disconnect=False,
+            dj_enabled=False,
+            dj_role=None,
+            emptydc_enabled=False,
+            emptydc_timer=0,
+            jukebox=False,
+            jukebox_price=0,
+            maxlength=0,
+            playlists={},
+            notify=False,
+            repeat=False,
+            shuffle=False,
+            thumbnail=False,
+            volume=100,
+            vote_enabled=False,
+            vote_percent=0,
+        )
 
         self.config.register_guild(**default_guild)
         self.config.register_global(**default_global)
@@ -86,9 +91,24 @@ def __init__(self, bot):
         self._connect_task = None
         self._disconnect_task = None
         self._cleaned_up = False
+
         self.spotify_token = None
         self.play_lock = {}
 
+        self._manager: Optional[ServerManager] = None
+
+    async def cog_before_invoke(self, ctx):
+        if self.llsetup in [ctx.command, ctx.command.root_parent]:
+            pass
+        elif self._connect_task.cancelled:
+            await ctx.send(
+                "You have attempted to run Audio's Lavalink server on an unsupported"
+                " architecture. Only settings related commands will be available."
+            )
+            raise RuntimeError(
+                "Not running audio command due to invalid machine architecture for Lavalink."
+            )
+
     async def initialize(self):
         self._restart_connect()
         self._disconnect_task = self.bot.loop.create_task(self.disconnect_timer())
@@ -103,16 +123,33 @@ def _restart_connect(self):
     async def attempt_connect(self, timeout: int = 30):
         while True:  # run until success
             external = await self.config.use_external_lavalink()
-            if not external:
-                shutdown_lavalink_server()
-                await maybe_download_lavalink(self.bot.loop, self)
-                await start_lavalink_server(self.bot.loop)
-            try:
+            if external is False:
+                settings = self._default_lavalink_settings
+                host = settings["host"]
+                password = settings["password"]
+                rest_port = settings["rest_port"]
+                ws_port = settings["ws_port"]
+                if self._manager is not None:
+                    await self._manager.shutdown()
+                self._manager = ServerManager()
+                try:
+                    await self._manager.start()
+                except RuntimeError as exc:
+                    log.exception(
+                        "Exception whilst starting internal Lavalink server, retrying...",
+                        exc_info=exc,
+                    )
+                    await asyncio.sleep(1)
+                    continue
+                except asyncio.CancelledError:
+                    log.exception("Invalid machine architecture, cannot run Lavalink.")
+                    break
+            else:
                 host = await self.config.host()
                 password = await self.config.password()
                 rest_port = await self.config.rest_port()
                 ws_port = await self.config.ws_port()
-
+            try:
                 await lavalink.initialize(
                     bot=self.bot,
                     host=host,
@@ -122,9 +159,10 @@ async def attempt_connect(self, timeout: int = 30):
                     timeout=timeout,
                 )
                 return  # break infinite loop
-            except Exception:
-                if not external:
-                    shutdown_lavalink_server()
+            except asyncio.TimeoutError:
+                log.error("Connecting to Lavalink server timed out, retrying...")
+                if external is False and self._manager is not None:
+                    await self._manager.shutdown()
                 await asyncio.sleep(1)  # prevent busylooping
 
     async def event_handler(self, player, event_type, extra):
@@ -3104,19 +3142,16 @@ async def external(self, ctx):
         await self.config.use_external_lavalink.set(not external)
 
         if external:
-            await self.config.host.set("localhost")
-            await self.config.password.set("youshallnotpass")
-            await self.config.rest_port.set(2333)
-            await self.config.ws_port.set(2332)
             embed = discord.Embed(
                 colour=await ctx.embed_colour(),
                 title=_("External lavalink server: {true_or_false}.").format(
                     true_or_false=not external
                 ),
             )
-            embed.set_footer(text=_("Defaults reset."))
             await ctx.send(embed=embed)
         else:
+            if self._manager is not None:
+                await self._manager.shutdown()
             await self._embed_msg(
                 ctx,
                 _("External lavalink server: {true_or_false}.").format(true_or_false=not external),
@@ -3229,6 +3264,8 @@ async def _check_api_tokens(self):
     async def _check_external(self):
         external = await self.config.use_external_lavalink()
         if not external:
+            if self._manager is not None:
+                await self._manager.shutdown()
             await self.config.use_external_lavalink.set(True)
             return True
         else:
@@ -3597,7 +3634,8 @@ def cog_unload(self):
 
             lavalink.unregister_event_listener(self.event_handler)
             self.bot.loop.create_task(lavalink.close())
-            shutdown_lavalink_server()
+            if self._manager is not None:
+                self.bot.loop.create_task(self._manager.shutdown())
             self._cleaned_up = True
 
     __del__ = cog_unload
diff --git a/redbot/cogs/audio/manager.py b/redbot/cogs/audio/manager.py
--- a/redbot/cogs/audio/manager.py
+++ b/redbot/cogs/audio/manager.py
@@ -1,172 +1,243 @@
-import shlex
+import itertools
+import pathlib
+import platform
 import shutil
 import asyncio
 import asyncio.subprocess
-import os
 import logging
 import re
-from subprocess import Popen, DEVNULL
-from typing import Optional, Tuple
+import tempfile
+from typing import Optional, Tuple, ClassVar, List
 
-from aiohttp import ClientSession
+import aiohttp
 
-import redbot.core
+from redbot.core import data_manager
 
-_JavaVersion = Tuple[int, int]
+JAR_VERSION = "3.2.0.3"
+JAR_BUILD = 751
+LAVALINK_DOWNLOAD_URL = (
+    f"https://github.com/Cog-Creators/Lavalink-Jars/releases/download/{JAR_VERSION}_{JAR_BUILD}/"
+    f"Lavalink.jar"
+)
+LAVALINK_DOWNLOAD_DIR = data_manager.cog_data_path(raw_name="Audio")
+LAVALINK_JAR_FILE = LAVALINK_DOWNLOAD_DIR / "Lavalink.jar"
+
+BUNDLED_APP_YML = pathlib.Path(__file__).parent / "data" / "application.yml"
+LAVALINK_APP_YML = LAVALINK_DOWNLOAD_DIR / "application.yml"
+
+READY_LINE_RE = re.compile(rb"Started Launcher in \S+ seconds")
+BUILD_LINE_RE = re.compile(rb"Build:\s+(?P<build>\d+)")
 
 log = logging.getLogger("red.audio.manager")
 
-proc = None
-shutdown = False
 
+class ServerManager:
 
-def has_java_error(pid):
-    from . import LAVALINK_DOWNLOAD_DIR
+    _java_available: ClassVar[Optional[bool]] = None
+    _java_version: ClassVar[Optional[Tuple[int, int]]] = None
+    _up_to_date: ClassVar[Optional[bool]] = None
 
-    poss_error_file = LAVALINK_DOWNLOAD_DIR / "hs_err_pid{}.log".format(pid)
-    return poss_error_file.exists()
+    _blacklisted_archs = ["armv6l", "aarch32", "aarch64"]
 
+    def __init__(self) -> None:
+        self.ready = asyncio.Event()
 
-async def monitor_lavalink_server(loop):
-    global shutdown
-    while shutdown is False:
-        if proc.poll() is not None:
-            break
-        await asyncio.sleep(0.5)
+        self._proc: Optional[asyncio.subprocess.Process] = None
+        self._monitor_task: Optional[asyncio.Task] = None
+        self._shutdown: bool = False
+
+    async def start(self) -> None:
+        arch_name = platform.machine()
+        if arch_name in self._blacklisted_archs:
+            raise asyncio.CancelledError(
+                "You are attempting to run Lavalink audio on an unsupported machine architecture."
+            )
 
-    if shutdown is False:
-        # Lavalink was shut down by something else
-        log.info("Lavalink jar shutdown.")
-        shutdown = True
-        if not has_java_error(proc.pid):
-            log.info("Restarting Lavalink jar.")
-            await start_lavalink_server(loop)
+        if self._proc is not None:
+            if self._proc.returncode is None:
+                raise RuntimeError("Internal Lavalink server is already running")
+            else:
+                raise RuntimeError("Server manager has already been used - create another one")
+
+        await self.maybe_download_jar()
+
+        # Copy the application.yml across.
+        # For people to customise their Lavalink server configuration they need to run it
+        # externally
+        shutil.copyfile(BUNDLED_APP_YML, LAVALINK_APP_YML)
+
+        args = await self._get_jar_args()
+        self._proc = await asyncio.subprocess.create_subprocess_exec(
+            *args,
+            cwd=str(LAVALINK_DOWNLOAD_DIR),
+            stdout=asyncio.subprocess.PIPE,
+            stderr=asyncio.subprocess.STDOUT,
+        )
+
+        log.info("Internal Lavalink server started. PID: %s", self._proc.pid)
+
+        try:
+            await asyncio.wait_for(self._wait_for_launcher(), timeout=120)
+        except asyncio.TimeoutError:
+            log.warning("Timeout occurred whilst waiting for internal Lavalink server to be ready")
+
+        self._monitor_task = asyncio.create_task(self._monitor())
+
+    @classmethod
+    async def _get_jar_args(cls) -> List[str]:
+        java_available, java_version = await cls._has_java()
+        if not java_available:
+            raise RuntimeError("You must install Java 1.8+ for Lavalink to run.")
+
+        if java_version == (1, 8):
+            extra_flags = ["-Dsun.zip.disableMemoryMapping=true"]
+        elif java_version >= (11, 0):
+            extra_flags = ["-Djdk.tls.client.protocols=TLSv1.2"]
         else:
-            log.error(
+            extra_flags = []
+
+        return ["java", *extra_flags, "-jar", str(LAVALINK_JAR_FILE)]
+
+    @classmethod
+    async def _has_java(cls) -> Tuple[bool, Optional[Tuple[int, int]]]:
+        if cls._java_available is not None:
+            # Return cached value if we've checked this before
+            return cls._java_available, cls._java_version
+        java_available = shutil.which("java") is not None
+        if not java_available:
+            cls.java_available = False
+            cls.java_version = None
+        else:
+            cls._java_version = version = await cls._get_java_version()
+            cls._java_available = (2, 0) > version >= (1, 8) or version >= (8, 0)
+        return cls._java_available, cls._java_version
+
+    @staticmethod
+    async def _get_java_version() -> Tuple[int, int]:
+        """
+        This assumes we've already checked that java exists.
+        """
+        _proc: asyncio.subprocess.Process = await asyncio.create_subprocess_exec(
+            "java", "-version", stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE
+        )
+        # java -version outputs to stderr
+        _, err = await _proc.communicate()
+
+        version_info: str = err.decode("utf-8")
+        # We expect the output to look something like:
+        #     $ java -version
+        #     ...
+        #     ... version "MAJOR.MINOR.PATCH[_BUILD]" ...
+        #     ...
+        # We only care about the major and minor parts though.
+        version_line_re = re.compile(
+            r'version "(?P<major>\d+).(?P<minor>\d+).\d+(?:_\d+)?(?:-[A-Za-z0-9]+)?"'
+        )
+        short_version_re = re.compile(r'version "(?P<major>\d+)"')
+
+        lines = version_info.splitlines()
+        for line in lines:
+            match = version_line_re.search(line)
+            short_match = short_version_re.search(line)
+            if match:
+                return int(match["major"]), int(match["minor"])
+            elif short_match:
+                return int(short_match["major"]), 0
+
+        raise RuntimeError(
+            "The output of `java -version` was unexpected. Please report this issue on Red's "
+            "issue tracker."
+        )
+
+    async def _wait_for_launcher(self) -> None:
+        log.debug("Waiting for Lavalink server to be ready")
+        for i in itertools.cycle(range(50)):
+            line = await self._proc.stdout.readline()
+            if READY_LINE_RE.search(line):
+                self.ready.set()
+                break
+            if self._proc.returncode is not None:
+                log.critical("Internal lavalink server exited early")
+            if i == 49:
+                # Sleep after 50 lines to prevent busylooping
+                await asyncio.sleep(0.1)
+
+    async def _monitor(self) -> None:
+        while self._proc.returncode is None:
+            await asyncio.sleep(0.5)
+
+        # This task hasn't been cancelled - Lavalink was shut down by something else
+        log.info("Internal Lavalink jar shutdown unexpectedly")
+        if not self._has_java_error():
+            log.info("Restarting internal Lavalink server")
+            await self.start()
+        else:
+            log.critical(
                 "Your Java is borked. Please find the hs_err_pid{}.log file"
-                " in the Audio data folder and report this issue.".format(proc.pid)
+                " in the Audio data folder and report this issue.",
+                self._proc.pid,
             )
 
-
-async def has_java(loop) -> Tuple[bool, Optional[_JavaVersion]]:
-    java_available = shutil.which("java") is not None
-    if not java_available:
-        return False, None
-
-    version = await get_java_version(loop)
-    return (2, 0) > version >= (1, 8) or version >= (8, 0), version
-
-
-async def get_java_version(loop) -> _JavaVersion:
-    """
-    This assumes we've already checked that java exists.
-    """
-    _proc: asyncio.subprocess.Process = await asyncio.create_subprocess_exec(
-        "java",
-        "-version",
-        stdout=asyncio.subprocess.PIPE,
-        stderr=asyncio.subprocess.PIPE,
-        loop=loop,
-    )
-    # java -version outputs to stderr
-    _, err = await _proc.communicate()
-
-    version_info: str = err.decode("utf-8")
-    # We expect the output to look something like:
-    #     $ java -version
-    #     ...
-    #     ... version "MAJOR.MINOR.PATCH[_BUILD]" ...
-    #     ...
-    # We only care about the major and minor parts though.
-    version_line_re = re.compile(
-        r'version "(?P<major>\d+).(?P<minor>\d+).\d+(?:_\d+)?(?:-[A-Za-z0-9]+)?"'
-    )
-    short_version_re = re.compile(r'version "(?P<major>\d+)"')
-
-    lines = version_info.splitlines()
-    for line in lines:
-        match = version_line_re.search(line)
-        short_match = short_version_re.search(line)
-        if match:
-            return int(match["major"]), int(match["minor"])
-        elif short_match:
-            return int(short_match["major"]), 0
-
-    raise RuntimeError(
-        "The output of `java -version` was unexpected. Please report this issue on Red's "
-        "issue tracker."
-    )
-
-
-async def start_lavalink_server(loop):
-    java_available, java_version = await has_java(loop)
-    if not java_available:
-        raise RuntimeError("You must install Java 1.8+ for Lavalink to run.")
-
-    if java_version == (1, 8):
-        extra_flags = "-Dsun.zip.disableMemoryMapping=true"
-    elif java_version >= (11, 0):
-        extra_flags = "-Djdk.tls.client.protocols=TLSv1.2"
-    else:
-        extra_flags = ""
-
-    from . import LAVALINK_DOWNLOAD_DIR, LAVALINK_JAR_FILE
-
-    start_cmd = "java {} -jar {}".format(extra_flags, LAVALINK_JAR_FILE.resolve())
-
-    global proc
-
-    if proc and proc.poll() is None:
-        return  # already running
-
-    proc = Popen(
-        shlex.split(start_cmd, posix=os.name == "posix"),
-        cwd=str(LAVALINK_DOWNLOAD_DIR),
-        stdout=DEVNULL,
-        stderr=DEVNULL,
-    )
-
-    log.info("Lavalink jar started. PID: {}".format(proc.pid))
-    global shutdown
-    shutdown = False
-
-    loop.create_task(monitor_lavalink_server(loop))
-
-
-def shutdown_lavalink_server():
-    global shutdown
-    shutdown = True
-    global proc
-    if proc is not None:
-        log.info("Shutting down lavalink server.")
-        proc.terminate()
-        proc.wait()
-        proc = None
-
-
-async def download_lavalink(session):
-    from . import LAVALINK_DOWNLOAD_URL, LAVALINK_JAR_FILE
-
-    with LAVALINK_JAR_FILE.open(mode="wb") as f:
-        async with session.get(LAVALINK_DOWNLOAD_URL) as resp:
-            while True:
-                chunk = await resp.content.read(512)
-                if not chunk:
-                    break
-                f.write(chunk)
-
-
-async def maybe_download_lavalink(loop, cog):
-    from . import LAVALINK_DOWNLOAD_DIR, LAVALINK_JAR_FILE, BUNDLED_APP_YML_FILE, APP_YML_FILE
-
-    jar_exists = LAVALINK_JAR_FILE.exists()
-    current_build = redbot.VersionInfo.from_json(await cog.config.current_version())
-
-    if not jar_exists or current_build < redbot.core.version_info:
-        log.info("Downloading Lavalink.jar")
-        LAVALINK_DOWNLOAD_DIR.mkdir(parents=True, exist_ok=True)
-        async with ClientSession(loop=loop) as session:
-            await download_lavalink(session)
-        await cog.config.current_version.set(redbot.core.version_info.to_json())
-
-    shutil.copyfile(str(BUNDLED_APP_YML_FILE), str(APP_YML_FILE))
+    def _has_java_error(self) -> bool:
+        poss_error_file = LAVALINK_DOWNLOAD_DIR / "hs_err_pid{}.log".format(self._proc.pid)
+        return poss_error_file.exists()
+
+    async def shutdown(self) -> None:
+        if self._shutdown is True or self._proc is None:
+            # For convenience, calling this method more than once or calling it before starting it
+            # does nothing.
+            return
+        log.info("Shutting down internal Lavalink server")
+        if self._monitor_task is not None:
+            self._monitor_task.cancel()
+        self._proc.terminate()
+        await self._proc.wait()
+        self._shutdown = True
+
+    @staticmethod
+    async def _download_jar() -> None:
+        log.info("Downloading Lavalink.jar...")
+        async with aiohttp.ClientSession() as session:
+            async with session.get(LAVALINK_DOWNLOAD_URL) as response:
+                if response.status == 404:
+                    raise RuntimeError(
+                        f"Lavalink jar version {JAR_VERSION}_{JAR_BUILD} hasn't been published"
+                    )
+                fd, path = tempfile.mkstemp()
+                file = open(fd, "wb")
+                try:
+                    chunk = await response.content.read(1024)
+                    while chunk:
+                        file.write(chunk)
+                        chunk = await response.content.read(1024)
+                    file.flush()
+                finally:
+                    file.close()
+                pathlib.Path(path).replace(LAVALINK_JAR_FILE)
+
+    @classmethod
+    async def _is_up_to_date(cls):
+        if cls._up_to_date is True:
+            # Return cached value if we've checked this before
+            return True
+        args = await cls._get_jar_args()
+        args.append("--version")
+        _proc = await asyncio.subprocess.create_subprocess_exec(
+            *args,
+            cwd=str(LAVALINK_DOWNLOAD_DIR),
+            stdout=asyncio.subprocess.PIPE,
+            stderr=asyncio.subprocess.STDOUT,
+        )
+        stdout = (await _proc.communicate())[0]
+        match = BUILD_LINE_RE.search(stdout)
+        if not match:
+            # Output is unexpected, suspect corrupted jarfile
+            return False
+        build = int(match["build"])
+        cls._up_to_date = build == JAR_BUILD
+        return cls._up_to_date
+
+    @classmethod
+    async def maybe_download_jar(cls):
+        if not (LAVALINK_JAR_FILE.exists() and await cls._is_up_to_date()):
+            await cls._download_jar()


Test patch: