Lavalink icon indicating copy to clipboard operation
Lavalink copied to clipboard

Allow setting YouTube timeout

Open freyacodes opened this issue 4 years ago • 11 comments

Possibly a workaround for #274, unless there is a different underlying cause

freyacodes avatar Apr 20 '20 14:04 freyacodes

This helps me!

Are you able to add a property for the timeout for generic HTTP(S) streams as well? This would be extremely useful for me. I have a system where sometimes I pass Lavalink the YouTube stream URL directly instead of using the LavaPlayer loader. These stream URLs time out after the classic 3000 ms because Lavalink doesn't consider them to be YouTube. I'd like to adjust that timing too.

cloudrac3r avatar May 25 '20 13:05 cloudrac3r

@cloudrac3r I am a bit stumped by your request. Generic YouTube stream URLs?

In Lavaplayer, the YouTube source provider gets asked if a given URL corresponds to it. The generic HTTP loader (which doesn't work for YouTube!) gets asked as one of the last source providers. If the HTTP provider truly tries to load it, it should be evident by the stack trace.

Though that doesn't explain your problem. The track loader API that Lavalink uses to load Lavaplayer tracks is the same that we use for playing tracks. In theory, we use the same HTTP client in both cases.

freyacodes avatar May 25 '20 16:05 freyacodes

Hmm. Can you tell me exactly which kinds of outgoing requests are affected by the youtubeTimeout setting?

cloudrac3r avatar May 25 '20 16:05 cloudrac3r

Should be anything sent by YoutubeAudioSourceManager, which should be anything to youtube.com.

Could you post your stack trace?

freyacodes avatar May 25 '20 16:05 freyacodes

The urls in question are for anything.googlevideo.com. I don't have logs or a stack trace of this at the moment, but I'll be sure to provide them when I next notice this happening.

cloudrac3r avatar May 25 '20 16:05 cloudrac3r

Now that makes more sense. I'm surprised you're getting a timeout on whatever cache is near you. Some large media providers like YouTube and Netflix have caching servers located with local ISPs.

We can change the timeout of the HTTP manager, though I don't particularly like the idea of using special config parameters like this. Perhaps a more generic config format would be nicer. Though I am not sure what that would look like.

freyacodes avatar May 25 '20 16:05 freyacodes

I tried the specific googlevideo URL on a few machines in different regions and IIRC it was slow in all of them. Just YouTube being YouTube. Next time I'm affected I will do a proper investigation and write down my findings for you.

This PR in its current form is definitely an improvement for normal use, though.

cloudrac3r avatar May 25 '20 16:05 cloudrac3r

I haven't had issues with timeouts since I last commented.

cloudrac3r avatar Jul 12 '20 05:07 cloudrac3r

Hey @freyacodes , I have a similar issue. I have attempted to setup ipv6 addresses using your guide (although I am using a /64 subset from hetzner, I did also try the /48 on a VPS), and I seem to be getting a timed out error. Sorry if this is a dumb question, but where can I try out this build? I tried the Dev build from the CL but it looks like it's not been merged yet, I also tried to build this repo with the changes, but was unsuccessful.

My error is here: https://cdn.mrrazamataz.ga/data/lavalinkipv6%20error.txt

Thank you.

MrRazamataz avatar Dec 08 '21 19:12 MrRazamataz

The problem is with your network configuration. Setting a higher timeout will not help.

freyacodes avatar Dec 09 '21 11:12 freyacodes

The problem is with your network configuration. Setting a higher timeout will not help.

Would you have any idea what I have done wrong? I have read your guide and the only bit I didnt do was the getting a /48 block as I had a /64 set that came with my machine from hetzner. Would you know any possible cause/fix?

Yes, my ping6 tests are successful.

MrRazamataz avatar Dec 09 '21 19:12 MrRazamataz