Open lenow55 opened 8 hours ago
Hi @lenow55 - Gradio establishes a persistent connection HTTP connection to know when you leave the page and clean up state variables. Browsers limit pages to establishing around ~4 connections at a time so that's what's happening. If you try across different browsers you won't see the behavior you see now.
Hi @lenow55 - Gradio establishes a persistent connection HTTP connection to know when you leave the page and clean up state variables. Browsers limit pages to establishing around ~4 connections at a time so that's what's happening. If you try across different browsers you won't see the behavior you see now.
Hi @freddyaboulton - But why can gradio generate without state more than 4 connections (please check threading_no_state.mp4 carefully), oposite, with state gradio can't generate more than 3 connections (please check threading_without_state.mp4 carefully)?
The connection (GET /heartbeat/
) is only established if there are gr.State
variables since it's used to delete state variables from memory when users close the page
The connection (GET
/heartbeat/
) is only established if there aregr.State
variables since it's used to delete state variables from memory when users close the page
Ok, i see. If i will use api for open multiple stream connection, gradio works as expected?
In company load testing our gradio service was carried out. In that cause api requests were used and service managed three connections also.
If i will use api for open multiple stream connection, gradio works as expected?
Yes. The limit is imposed by browsers. Connecting via API (e.g. gradio_client
) should be fine.
Describe the bug
When i use gr.State to hold information about user_id, concurency work bad. I can run three generators simultaneously but no more. And it does not depend on the asynchrony of the function.
When i remove state, concurency work as expected.
Have you searched existing issues? ๐
Reproduction
Screenshot
No response
Logs
No response
System Info
Severity
I can work around it