gradio: ValueError("Event not found", event_id)

Describe the bug

Running on local URL:  http://127.0.0.1:7860

To create a public link, set `share=True` in `launch()`.
ERROR:    Exception in ASGI application
Traceback (most recent call last):
  File "/usr/local/anaconda3/envs/lib/python3.8/site-packages/uvicorn/protocols/http/h11_impl.py", line 408, in run_asgi
    result = await app(  # type: ignore[func-returns-value]
  File "/usr/local/anaconda3/envs/lib/python3.8/site-packages/uvicorn/middleware/proxy_headers.py", line 84, in __call__
    return await self.app(scope, receive, send)
  File "/usr/local/anaconda3/envs/lib/python3.8/site-packages/fastapi/applications.py", line 1106, in __call__
    await super().__call__(scope, receive, send)
  File "/usr/local/anaconda3/envs/lib/python3.8/site-packages/starlette/applications.py", line 122, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/usr/local/anaconda3/envs/lib/python3.8/site-packages/starlette/middleware/errors.py", line 184, in __call__
    raise exc
  File "/usr/local/anaconda3/envs/lib/python3.8/site-packages/starlette/middleware/errors.py", line 162, in __call__
    await self.app(scope, receive, _send)
  File "/usr/local/anaconda3/envs/lib/python3.8/site-packages/starlette/middleware/cors.py", line 91, in __call__
    await self.simple_response(scope, receive, send, request_headers=headers)
  File "/usr/local/anaconda3/envs/lib/python3.8/site-packages/starlette/middleware/cors.py", line 146, in simple_response
    await self.app(scope, receive, send)
  File "/usr/local/anaconda3/envs/lib/python3.8/site-packages/starlette/middleware/exceptions.py", line 79, in __call__
    raise exc
  File "/usr/local/anaconda3/envs/lib/python3.8/site-packages/starlette/middleware/exceptions.py", line 68, in __call__
    await self.app(scope, receive, sender)
  File "/usr/local/anaconda3/envs/python3.8/site-packages/fastapi/middleware/asyncexitstack.py", line 20, in __call__
    raise e
  File "/usr/local/anaconda3/envs/lib/python3.8/site-packages/fastapi/middleware/asyncexitstack.py", line 17, in __call__
    await self.app(scope, receive, send)
  File "/usr/local/anaconda3/envs/lib/python3.8/site-packages/starlette/routing.py", line 718, in __call__
    await route.handle(scope, receive, send)
  File "/usr/local/anaconda3/envs/lib/python3.8/site-packages/starlette/routing.py", line 276, in handle
    await self.app(scope, receive, send)
  File "/usr/local/anaconda3/envs/lib/python3.8/site-packages/starlette/routing.py", line 66, in app
    response = await func(request)
  File "/usr/local/anaconda3/envs/lib/python3.8/site-packages/fastapi/routing.py", line 274, in app
    raw_response = await run_endpoint_function(
  File "/usr/local/anaconda3/envs/lib/python3.8/site-packages/fastapi/routing.py", line 191, in run_endpoint_function
    return await dependant.call(**values)
  File "/usr/local/anaconda3/envs/lib/python3.8/site-packages/gradio/routes.py", line 657, in queue_data
    blocks._queue.attach_data(body)
  File "/usr/local/anaconda3/envs/lib/python3.8/site-packages/gradio/queueing.py", line 132, in attach_data
    raise ValueError("Event not found", event_id)
ValueError: ('Event not found', 'f4773247957646479b083f93e1dc4a63')
ERROR:    Exception in ASGI application
Traceback (most recent call last):
  File "/usr/local/anaconda3/envs/lib/python3.8/site-packages/uvicorn/protocols/http/h11_impl.py", line 408, in run_asgi
    result = await app(  # type: ignore[func-returns-value]
  File "/usr/local/anaconda3/envs/lib/python3.8/site-packages/uvicorn/middleware/proxy_headers.py", line 84, in __call__
    return await self.app(scope, receive, send)
  File "/usr/local/anaconda3/envs/lib/python3.8/site-packages/fastapi/applications.py", line 1106, in __call__
    await super().__call__(scope, receive, send)
  File "/usr/local/anaconda3/envs/lib/python3.8/site-packages/starlette/applications.py", line 122, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/usr/local/anaconda3/envs/lib/python3.8/site-packages/starlette/middleware/errors.py", line 184, in __call__
    raise exc
  File "/usr/local/anaconda3/envs/lib/python3.8/site-packages/starlette/middleware/errors.py", line 162, in __call__
    await self.app(scope, receive, _send)
  File "/usr/local/anaconda3/envs/lib/python3.8/site-packages/starlette/middleware/cors.py", line 91, in __call__
    await self.simple_response(scope, receive, send, request_headers=headers)
  File "/usr/local/anaconda3/envs/lib/python3.8/site-packages/starlette/middleware/cors.py", line 146, in simple_response
    await self.app(scope, receive, send)
  File "/usr/local/anaconda3/envs/lib/python3.8/site-packages/starlette/middleware/exceptions.py", line 79, in __call__
    raise exc
  File "/usr/local/anaconda3/envs/lib/python3.8/site-packages/starlette/middleware/exceptions.py", line 68, in __call__
    await self.app(scope, receive, sender)
  File "/usr/local/anaconda3/envs/lib/python3.8/site-packages/fastapi/middleware/asyncexitstack.py", line 20, in __call__
    raise e
  File "/usr/local/anaconda3/envs/lib/python3.8/site-packages/fastapi/middleware/asyncexitstack.py", line 17, in __call__
    await self.app(scope, receive, send)
  File "/usr/local/anaconda3/envs/lib/python3.8/site-packages/starlette/routing.py", line 718, in __call__
    await route.handle(scope, receive, send)
  File "/usr/local/anaconda3/envs/lib/python3.8/site-packages/starlette/routing.py", line 276, in handle
    await self.app(scope, receive, send)
  File "/usr/local/anaconda3/envs/lib/python3.8/site-packages/starlette/routing.py", line 66, in app
    response = await func(request)
  File "/usr/local/anaconda3/envs/lib/python3.8/site-packages/fastapi/routing.py", line 274, in app
    raw_response = await run_endpoint_function(
  File "/usr/local/anaconda3/envs/lib/python3.8/site-packages/fastapi/routing.py", line 191, in run_endpoint_function
    return await dependant.call(**values)
  File "/usr/local/anaconda3/envs/lib/python3.8/site-packages/gradio/routes.py", line 657, in queue_data
    blocks._queue.attach_data(body)
  File "/usr/local/anaconda3/envs/lib/python3.8/site-packages/gradio/queueing.py", line 132, in attach_data
    raise ValueError("Event not found", event_id)
ValueError: ('Event not found', '96be8e419b5b49c6a10fc06a81d5399f')

Have you searched existing issues? πŸ”Ž

  • I have searched and found no existing issues

Reproduction

import gradio as gr
import librosa
import webbrowser

app = gr.Blocks()
    with app:
        with gr.Tab("T"):
            with gr.Row():
                with gr.Column():
                    textbox = gr.TextArea(label="Text",
                                          placeholder="Type your sentence here",
                                          value="", elem_id=f"input")
                with gr.Column():
                    text_output = gr.Textbox(label="Message")
                    audio_output = gr.Audio(label="Output Audio", elem_id="audio")
                    btn = gr.Button("Generate!")
                    btn.click(tts_fn,
                              inputs=[textbox],
                              outputs=[text_output, audio_output])

    webbrowser.open("http://127.0.0.1:7860/")
    app.launch(share=False)

Screenshot

No response

Logs

No response

System Info

conda environment

python 3.8
gradio                    4.1.0
gradio                    4.1.1
gradio                    4.1.2

gradio_client             0.7.0


### Severity

Blocking usage of gradio

About this issue

  • Original URL
  • State: closed
  • Created 8 months ago
  • Comments: 16

Most upvoted comments

does this error happen on every submission? can you share code?

NGINX Server Configuration:

server{
                server_name example.domain.com;

                location / {
                        proxy_pass http://localhost:7777;
                        proxy_http_version 1.1;
                        proxy_set_header Upgrade $http_upgrade;
                        proxy_set_header Connection "upgrade";
                        proxy_set_header Host $host;
                }

                listen 443 ssl; # managed by Certbot
                ssl_certificate /etc/letsencrypt/live/example.domain.com/fullchain.pem; # managed by Certbot
                ssl_certificate_key /etc/letsencrypt/live/example.domain.com/privkey.pem; # managed by Certbot
                include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
                ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}

Gradio code:

    
    css = "css here..."
    html = "html here..."


    with gr.Blocks(title="Bot Beta 1.2.0", css=css) as app:

        gr.HTML(html)
        with gr.Row(elem_classes=["nav"]):
                gr.Image(
                    value="./static/images/logo.png", 
                    show_download_button=False,
                    container=False, 
                    label="Company Name", 
                    width=100,
                    height=100,
                    elem_classes=["logo"]
                )
                gr.HTML("<h1>Company Name</h1><h3>Bot - Beta Ver.</h3>", elem_classes=["logo-font"])

        with gr.Row():
            gr.HTML("<h5>Anonymous: Conversation will not be saved.</h5>")

        chatbot_value = None

        if prepopulat_message:
            chatbot_value = [[None, prepopulat_message]]

        chatbot = gr.Chatbot(
            label="Bopy Alpha V2.0",
            value=chatbot_value,
            height=500
        )

        with gr.Row(equal_height=True):
            msg = gr.Textbox(label="Your Message:", scale=3)
            with gr.Row(equal_height=True):
                send = gr.Button("Send")
                clear = gr.Button("Clear Chat")


        sammy = Sammy() # This is my LLM model
        # sammy = None
        flag = True

        msg.submit(user, [msg, chatbot], [msg, chatbot], queue=True).then(
            bot, chatbot, chatbot
        )
        send.click(user, [msg, chatbot], [msg, chatbot], queue=True, concurrency_limit=3).then(
            bot, chatbot, chatbot
        )
        clear.click(lambda: None, None, chatbot, queue=True)
    
    app.launch(
        show_api=False, 
        share=False, 
        server_name="0.0.0.0", 
        server_port=7777, 
        debug=True,
        ssl_verify=False,
        max_threads=20
    )

When I set nginx to port 80 without an ssl, it works and there are no errors.

After hours of debug, it turns out I was just missing proxy_buffering off; in location / 😭😭😭

@AntroSafin I downgraded to β€œgradio<4.0” (which the last version is 3.50.2) and I am not longer seeing this issue, even without passing enable_queue=False.

When I set : app.launch(share=False, enable_queue=False)

No bugs