Open futurist opened 1 week ago
Pingora Server
inside an async runtime is not supported. The reason is the Server
itself needs to spawn and manage the async runtimes but Tokio doesn't support doing so inside a runtime.
So how to run tokio::spawn
?
tokio::spwan
there, but the server is unresponsive, is it due to the #[async_trait]
macro?#[tokio::main]
async function, the http server work normally.Even I've changed the conf.work_stealing = false
when start the proxy server, the problem still exits.
What is the goal you want to achieve here?
run_forever()
shouldn't be and doesn't need to be inside a tokio runtime.
The goal is to run pingora and many backend service at the same time, since it's mono app, only one executable deployed.
I see now.
Maybe you can try thread::spawn(|| { my_server.run_forever(); });
so that the pingora server is free from the current tokio runtime so that it can manage its own.
Or, if the question is "how to let the Pingora server just run its tasks inside the provided current runtime", that is a feature request that we might implement.
@eaufavor yes exactly. I've changed the title.
also the process::exit
behavior prevent other runtime service to shutdown gracefully, which is also related issue: https://github.com/cloudflare/pingora/issues/154
This question has been stale for a week. It will be closed in an additional day if not updated.
Describe the bug
Thread panic when run_forever within tokio::spawn, like below:
Above will panic,
Pingora info
Please include the following information about your environment:
Pingora version: 0.2.0 from crates.io Rust version: cargo 1.78.0 (54d8815d0 2024-03-26) Operating system version: MacOS 13.4