-
Notifications
You must be signed in to change notification settings - Fork 2.9k
gradio 4 critical bug -- all return messages truncated to 65k #6601
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
If It try to debug the clent for the above running server, and step through stream_sse(), eventually for no obvious reason it hits on client:
and on server:
It's like the client-server connection is unstable to timing choices that come from how the async stream is handled. That's not good. |
My guess is this is the offending changes: #6069 FYI @aliabid94 It seems to be both unstable (timing dependent) and wrong (truncation) |
Actually I can't tell where things changed. Maybe make_predict changes by @pngwn |
If I start messing with the stream_sse() code, e.g. just adding a print or something, I can see random changes in behavior. Sometimes the print shows full correct output, sometimes not. All a mess. i.e. just this debug:
Then one sees the last number before failure is all over the place. sometimes 32761, 65529, both fail. But if put instead:
Even though doesn't make it work (not intended), sometimes I see the full message printed with size 65536 but of course the "continue" is not valid and leads to other issues. But without the continue I never see the right length. |
This seems to work:
i.e. aiter_lines() instead of aiter_text() and ignoring 0 length lines. Related: encode/httpx#2310 |
But it's not a perfect fix. I sometimes see:
|
Thanks for the detailed report @pseudotensor. Is this only an issue when you are using the Client to make a prediction, or even if you use the Gradio app via UI? |
So far only seen in API use, and the only changes to work-around so far are in client side. |
Even with the work-arounds I did so far, still hit this and get hangs:
|
Will probably have to revert back to gradio 3. Just too unstable. |
We're working through a few issues related to the Client, e.g. #6602 Btw was just looking at your Client code, and noticed that you have: import time
from gradio_client import Client
client = Client('http://localhost:7860', serialize=False) In Gradio 4.x, you don't need to set import time
from gradio_client import Client
client = Client('http://localhost:7860') Will work through the other issues you mentioned here soon. |
I need sanitize=False in general for many other reasons. E.g. if through API I push http link into text box, it gets converted into {'path': filename} like dict with a filename as a temp file made (not sure by client or server). I don't want any of those conversions done. And since the client is global to any API calls, I must disable serialize entirely and get strictly un-processed inputs from client -> server and server -> client. |
Got it okay, we can explore those issues later, let's get this unblocked first |
…o#5914, gradio4 is too unstable to use until various things fixed: gradio-app/gradio#6592 gradio-app/gradio#6282 gradio-app/gradio#6319 gradio-app/gradio#6601
Hi @pseudotensor ! Thanks for all of the helpful comments you left on this thread as you investigated the issue. I think I have a fix in #6693. I would appreciate if you could test it out. You can install the client from that PR with
That PR only targets the 65k response length issue and the hearbeat issue (#6319). There are still some other issues with the client we are fixing. And #6556 should hopefully fix a lot of them. |
Describe the bug
In gradio 3 there were never any issues with returning large amounts of text or data. However, in gradio 4 this is totally broken.
This is super critical bug given how broadly it applies to all API calls of any return type (text, audio, etc.).
Related: #6319
that is, even once heartbeat bug is fixed, long output still hits json error mentioned there.
Have you searched existing issues? 🔎
Reproduction
server:
client:
Error:
When checking the details, the issue is that all messages of any kind are truncated to no more than 65k bytes. This was never a problem with gradio 3 and I can see large messages work perfectly fine.
For audio and video this is a DOA for gradio 4 and its API.
Screenshot
No response
Logs
No response
System Info
Severity
Blocking usage of gradio
The text was updated successfully, but these errors were encountered: