Closed hyperpastel closed 1 year ago
Thank you for this detailed bug report and the huge amount of work you invested into debugging this obscure problem already
I don't know what is happening either... the symptoms remind me of the async runtime being blocked? I see you enabled "rt-multi-thread"
but maybe the VPS only has one core
Can you try disabling rt-multi-thread
on your dev machine? Maybe it will reproduce the infinite wait
Dear kangalio,
You are an angel.
After disabling rt-multi-thread
and setting #[tokio::main(flavor = "current_thread")]
on my dev machine, I was indeed able to reproduce the error locally!
The docs for tokio::main tell that when no flavor is set, tokio will default to the multi thread flavor with the amount of worker threads equal to the machine's cores. In the case of my VPS, this is - as you correctly assumed - one core, making it equivalent to the current_thread flavor. This was apparently not enough to handle the concurency needed during dns resolution.
After manually setting the amount of worker threads to 2 by changing the macro to
#[tokio::main(flavor = "multi_thread", worker_threads = 2)]
I was finally able to get it to work.
Thank you for maintaining this project and helping me ♥
Hello all,
I wrote a bot using poise, and it works on my machine, but it behaves abnormally when I run it on my VPS.
When I call
FramworkBuilder::build()
, that method gets stuck when reqwest is trying to load the application info (RouteInfo::GetCurrentApplicationInfo
).I use tokio with multiple tasks. All of them start fine, including the one for the bot, until it calls this functions. The weird thing is that it compiles just fine, no complaints from cargo or rustc, and also no crashes. It just... waits infinitely? I turned on env_logger with the level set to trace, which yielded the following.
Running with tracing and tracing_subscriber yields
I have tried putting this application into a docker container, only to find myself in the exact same scenario again: It works on my machine, but it hangs when ran on my VPS (even using containers!).
I have tried to do println debugging via ssh and got this: The error right now happens when serenity's
Ratelimiter
performs theRouteInfo::GetCurrentApplicationInfo
request inside the Framework builder. This makes an HTTP request via reqwest / hyper, and the deepest I've been able to track the halting point down to is this block of code, which execution will not be able to get past.https://github.com/hyperium/hyper/blob/d342c2c714498d33891fa285a3c9ae991dc34769/src/client/client.rs#L472
Paradoxically, neither hyper nor reqwest seems to be the fundamental problem here, as I was able to successfully make an HTTP request towards Discord's API with the following code (this worked locally and on my server).
Cargo.toml of the executable
Code that starts the bot
Things I tried:
Require https://github.com/sfackler/rust-native-tls and enable the
vendored
flag so it ships with it's own openssl implementationI really don't know how any of this is happening. If anything else is required to understand this problem, please let me know. Any and all help is appreciated