fix : queue could be blocked#2288
Conversation
| return | ||
| begin_time = time.time() | ||
| response = await self.call_prediction(event) | ||
| if response.json.get("is_generating", False): |
There was a problem hiding this comment.
It's hard to know what the best solution is since we don't have a reproducer. However, looking at the code for the Response class, the json_response_data is not set only if there is an exception raised while sending the request. Given that, I wonder if the better solution is to check whether response.is_valid() or response.has_exception prior to accessing the JSON and if it is not valid, send the following message
{"msg": "process_completed",
"output": {"error": str(response.exception)}
"success": False
}What do you think @aliabid94 @SkyTNT
There was a problem hiding this comment.
Sounds good. I think we also need to raise response.exception
|
Thank you for the contribution @SkyTNT ! We don't need to raise an exception as the front-end will automatically raise it for us. I added some unit tests too. |
|
Hello, when to update PyPI package to include this PR? It's very critical. |
|
Hi @nttstar we should have a release out on Monday or Tuesday, but in the meantime you can try the beta release |
|
Still exist in 3.27.0 @freddyaboulton |
|
How can we reproduce @liminghao1630 ? |
Description
Surround the code in gradio.queue.Queue.process_event with try...finally... to ensure that the processed events in the queue are cleared to avoid the queue being blocked.
Closes: #2261
Checklist: