You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been using reqwest as a web client in an actix-web project as a client to request data from another server.
Everything works as expected but one call just does not return and hangs the whole actix-web server if and only if there is another call request directly after.
Example
A webbrowser loads /index.html which upon loading sends two fetch requests to load something from my api
The server goes through some code and decides that it needs to request that data from another server
It sends a request via a "reqwest::async_impl::client::Client" using "send().await"
While one thread waits for the answer, the second requests comes in
It does not matter what that request does (i've stopped it directly in the get handler function) but the fact that that request comes in now basically freezes the whole server
Sometime static content (via actix_files) will still work for a few requests but otherwise the server is completely dead
I've tried troubleshooting the issue but i have no idea why this specific flow of code causes it. I have other endpoints that can be requested 10 times in a seconds and also use the reqwest client concurrently and there is no issue there.
For now i have switched to the blocking implementation (reqwest::blocking::Client) which is far from ideal because now debug build will always crash but at least the server won't freeze.
I've also tried to put the blocking implementation in a actix_web::rt::Runtime::block_on call which will make the debug work again but has the same issue of freezing the server.
It seems that this is an issue with the asynchronous implementation.
I've also used tokio-console which shows 2 tasks are infinitely active:
I've been using reqwest as a web client in an actix-web project as a client to request data from another server.
Everything works as expected but one call just does not return and hangs the whole actix-web server if and only if there is another call request directly after.
Example
I've tried troubleshooting the issue but i have no idea why this specific flow of code causes it. I have other endpoints that can be requested 10 times in a seconds and also use the reqwest client concurrently and there is no issue there.
For now i have switched to the blocking implementation (reqwest::blocking::Client) which is far from ideal because now debug build will always crash but at least the server won't freeze.
I've also tried to put the blocking implementation in a actix_web::rt::Runtime::block_on call which will make the debug work again but has the same issue of freezing the server.
It seems that this is an issue with the asynchronous implementation.
I've also used tokio-console which shows 2 tasks are infinitely active:
I'm not sure if this indicates that this is a problem with actix instead of reqwest.
Versions
actix-web: 4.4.1 (tested on newest 4.5.1 one as well)
reqwest: 0.11.24 (newest)
I've tried to reproduce it with minimal amount of code but it always works there.
Below is some debug output, hope it helps:
Strace
Single request (no problem)
Two requests in a row (will cause the freeze)
Trace output (.output_verbose(true)
Trace output from the program
The text was updated successfully, but these errors were encountered: