Skip to content
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

JS-Error in Browser-Console: heartbeat/nsi77w2je2 net::ERR_INCOMPLETE_CHUNKED_ENCODING 200 #9999

Open
1 task done
machnicole opened this issue Nov 19, 2024 · 0 comments
Open
1 task done
Assignees
Labels
bug Something isn't working cloud Issues that only happen when deploying Gradio on cloud services

Comments

@machnicole
Copy link

Describe the bug

We deploy our gradio-Chatbot with AWS App Runner.
On App Runner, there is a 120s timeout:

There is a total of 120 seconds request timeout limit on the HTTP requests. The 120 seconds include the time the application takes to read the request, including the body, and complete writing the HTTP response.

See https://docs.aws.amazon.com/apprunner/latest/dg/develop.html

The JS-error occurs only on the remote AWS App Runner environment, linked to the App Runner timeout.

When the page loads initially, an initial Server-Sent Events (SSE) connection is opened but remains open without closing. After 120 seconds, the connection hits the App Runner timeout and disconnects, causing a console error (e.g., net::ERR_INCOMPLETE_CHUNKED_ENCODING in Chrome or NS_ERROR_NET_PARTIAL_TRANSFER in Firefox).
This initial connection is separate from connections opened and closed for each chat message.

My analysis so far:

  • This behavior seems to have started since this commit, which introduces repeated calls to the connect method here for the client.
  • It’s unclear if/when this initial connection is closed. It appears that nothing significant is transmitted over this initial SSE connection, which mostly pings the "heartbeat" endpoint to check if the application is alive.
  • The heartbeat endpoint returns a regular status (e.g., "ALIVE") but may not do anything with this response. After 120 seconds, the stream times out and triggers the error

There is no observed impact on chatbot functionality, but we don't really want to deploy anything that causes JS-errors.

Have you searched existing issues? 🔎

  • I have searched and found no existing issues

Reproduction

It is a bit tricky to reproduce this error without having to deploy on AWS App Runner.
However, you can just use this simple demo:

import random
import gradio as gr


def random_response(message, history):
    return random.choice(["Yes", "No"])

gr.ChatInterface(random_response, type="messages").launch()

And then set a breakpoint under "Sources" in "client/js/src/client.ts" here.
Then you can see that an initial connection is opened on the initial page load.
The comment there even says:

// Just connect to the endpoint without parsing the response. Ref: https://github.com/gradio-app/gradio/pull/7974#discussion_r1557717540

Screenshot

image

Logs

dummy/gradio_api/heartbeat/j3sx9yr4dk:1 
        
        
       Failed to load resource: net::ERR_INCOMPLETE_CHUNKED_ENCODING

System Info

Gradio Environment Information:
------------------------------
Operating System: Darwin
gradio version: 5.5.0
gradio_client version: 1.4.2

------------------------------------------------
gradio dependencies in your environment:

aiofiles: 23.2.1
anyio: 4.6.2.post1
audioop-lts is not installed.
fastapi: 0.115.4
ffmpy: 0.4.0
gradio-client==1.4.2 is not installed.
httpx: 0.27.2
huggingface-hub: 0.26.2
jinja2: 3.1.4
markupsafe: 2.1.5
numpy: 2.1.3
orjson: 3.10.11
packaging: 24.2
pandas: 2.2.3
pillow: 11.0.0
pydantic: 2.9.2
pydub: 0.25.1
python-multipart==0.0.12 is not installed.
pyyaml: 6.0.2
ruff: 0.7.3
safehttpx: 0.1.1
semantic-version: 2.10.0
starlette: 0.41.2
tomlkit==0.12.0 is not installed.
typer: 0.13.0
typing-extensions: 4.12.2
urllib3: 2.2.3
uvicorn: 0.32.0
authlib; extra == 'oauth' is not installed.
itsdangerous; extra == 'oauth' is not installed.


gradio_client dependencies in your environment:

fsspec: 2024.10.0
httpx: 0.27.2
huggingface-hub: 0.26.2
packaging: 24.2
typing-extensions: 4.12.2
websockets: 12.0

Severity

I can work around it

@machnicole machnicole added the bug Something isn't working label Nov 19, 2024
@abidlabs abidlabs added the cloud Issues that only happen when deploying Gradio on cloud services label Nov 19, 2024
@hannahblair hannahblair self-assigned this Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cloud Issues that only happen when deploying Gradio on cloud services
Projects
None yet
Development

No branches or pull requests

3 participants