ddellspe / music-bot

Discord Music Bot
Apache License 2.0
2 stars 1 forks source link

Add retries for adding track #64

Open ddellspe opened 1 year ago

ddellspe commented 1 year ago

It seems after some amount of idle time, the api to play the youtube songs fails? It has the following log trace:

music-bot    | 2023-08-29T00:52:11.964187670Z [lava-daemon-pool-playback-1-thread-1] ERROR com.sedmelluq.discord.lavaplayer.track.playback.LocalAudioTrackExecutor - Error in playback of KajGqKJ3ePg
music-bot    | 2023-08-29T00:52:11.964402022Z com.sedmelluq.discord.lavaplayer.tools.FriendlyException: Something broke when playing the track.
music-bot    | 2023-08-29T00:52:11.964610733Z   at com.sedmelluq.discord.lavaplayer.tools.ExceptionTools.wrapUnfriendlyExceptions(ExceptionTools.java:44)
music-bot    | 2023-08-29T00:52:11.964657560Z   at com.sedmelluq.discord.lavaplayer.track.playback.LocalAudioTrackExecutor.execute(LocalAudioTrackExecutor.java:116)
music-bot    | 2023-08-29T00:52:11.964668842Z   at com.sedmelluq.discord.lavaplayer.player.DefaultAudioPlayerManager.lambda$executeTrack$1(DefaultAudioPlayerManager.java:348)
music-bot    | 2023-08-29T00:52:11.964831169Z   at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
music-bot    | 2023-08-29T00:52:11.964855585Z   at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
music-bot    | 2023-08-29T00:52:11.964863166Z   at java.base/java.lang.Thread.run(Unknown Source)
music-bot    | 2023-08-29T00:52:11.964905619Z   Suppressed: com.sedmelluq.discord.lavaplayer.tools.exception.EnvironmentInformation:
music-bot    | 2023-08-29T00:52:11.964923301Z   lavaplayer.version: 1.3.78
music-bot    | 2023-08-29T00:52:11.964929730Z   os.arch: amd64
music-bot    | 2023-08-29T00:52:11.964935718Z   os.name: Linux
music-bot    | 2023-08-29T00:52:11.964940933Z   os.version: 5.15.0-79-generic
music-bot    | 2023-08-29T00:52:11.964946228Z   java.vendor: Eclipse Adoptium
music-bot    | 2023-08-29T00:52:11.964951760Z   java.version: 17.0.8
music-bot    | 2023-08-29T00:52:11.964956963Z   java.runtime.version: 17.0.8+7
music-bot    | 2023-08-29T00:52:11.964962483Z   java.vm.version: 17.0.8+7
music-bot    | 2023-08-29T00:52:11.965163954Z Caused by: java.lang.RuntimeException: Not success status code: 403
music-bot    | 2023-08-29T00:52:11.965202829Z   at com.sedmelluq.discord.lavaplayer.tools.io.PersistentHttpStream.validateStatusCode(PersistentHttpStream.java:87)
music-bot    | 2023-08-29T00:52:11.965244058Z   at com.sedmelluq.discord.lavaplayer.tools.io.PersistentHttpStream.attemptConnect(PersistentHttpStream.java:116)
music-bot    | 2023-08-29T00:52:11.965280216Z   at com.sedmelluq.discord.lavaplayer.tools.io.PersistentHttpStream.connect(PersistentHttpStream.java:105)
music-bot    | 2023-08-29T00:52:11.965318799Z   at com.sedmelluq.discord.lavaplayer.tools.io.PersistentHttpStream.internalRead(PersistentHttpStream.java:150)
music-bot    | 2023-08-29T00:52:11.965348434Z   at com.sedmelluq.discord.lavaplayer.tools.io.PersistentHttpStream.read(PersistentHttpStream.java:166)
music-bot    | 2023-08-29T00:52:11.965375817Z   at java.base/java.io.DataInputStream.readByte(Unknown Source)
music-bot    | 2023-08-29T00:52:11.965413966Z   at com.sedmelluq.discord.lavaplayer.container.matroska.format.MatroskaEbmlReader.readEbmlInteger(MatroskaEbmlReader.java:39)
music-bot    | 2023-08-29T00:52:11.965450228Z   at com.sedmelluq.discord.lavaplayer.container.matroska.format.MatroskaFileReader.readNextElement(MatroskaFileReader.java:45)
music-bot    | 2023-08-29T00:52:11.965532027Z   at com.sedmelluq.discord.lavaplayer.container.matroska.MatroskaStreamingFile.readFile(MatroskaStreamingFile.java:78)
music-bot    | 2023-08-29T00:52:11.965546429Z   at com.sedmelluq.discord.lavaplayer.container.matroska.MatroskaAudioTrack.loadMatroskaFile(MatroskaAudioTrack.java:51)
music-bot    | 2023-08-29T00:52:11.965619832Z   at com.sedmelluq.discord.lavaplayer.container.matroska.MatroskaAudioTrack.process(MatroskaAudioTrack.java:34)
music-bot    | 2023-08-29T00:52:11.965633048Z   at com.sedmelluq.discord.lavaplayer.track.DelegatedAudioTrack.processDelegate(DelegatedAudioTrack.java:25)
music-bot    | 2023-08-29T00:52:11.965655240Z   at com.sedmelluq.discord.lavaplayer.source.youtube.YoutubeAudioTrack.processStatic(YoutubeAudioTrack.java:57)
music-bot    | 2023-08-29T00:52:11.965686717Z   at com.sedmelluq.discord.lavaplayer.source.youtube.YoutubeAudioTrack.process(YoutubeAudioTrack.java:49)
music-bot    | 2023-08-29T00:52:11.965725241Z   at com.sedmelluq.discord.lavaplayer.track.playback.LocalAudioTrackExecutor.execute(LocalAudioTrackExecutor.java:104)
music-bot    | 2023-08-29T00:52:11.965763981Z   ... 4 more

This SHOULD be able to be caught and potentially retried pending the status code?

ddellspe commented 1 year ago

It seems there's an onTrackException method that we can override in the AudioEventAdapter abstract class that we extend in the MusicAudioTrackScheduler in order to handle these situations, one option would be to retry the track add (that likely will work) but we'll have to look deeper at those cases (I'd like to re-create the scenario, if possible))