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

Repeated "Invalid URI. Load of media resource failed." when recording audio in Firefox leads to browser crash #8135

Open
1 task done
mamei16 opened this issue Apr 25, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@mamei16
Copy link

mamei16 commented Apr 25, 2024

Describe the bug

After stopping a microphone recording in Firefox, it seems some JavaScript function is called over and over again indefinitely, each time triggering the error Invalid URI. Load of media resource failed. This leads to excessive CPU usage even when the web UI is idle after recording audio. It appears that after each recording, another asynchronous function starts calling the problematic function, leading to CPU usage increasing further with each recording, until the web UI becomes laggy and Firefox finally crashes.

The logs below show the browser console after recording two audio clips.

Have you searched existing issues? 🔎

  • I have searched and found no existing issues

Reproduction

import os

import numpy as np

import gradio as gr


def reverse_audio(audio):
    sr, data = audio
    return (sr, np.flipud(data))


input_audio = gr.Audio(
    sources=["microphone"],
    waveform_options=gr.WaveformOptions(
        waveform_color="#01C6FF",
        waveform_progress_color="#0066B4",
        skip_length=2,
        show_controls=False,
    ),
)
demo = gr.Interface(
    fn=reverse_audio,
    inputs=input_audio,
    outputs="audio"
)

if __name__ == "__main__":
    demo.launch()

Screenshot

No response

Logs

Invalid URI. Load of media resource  failed. 4 127.0.0.1:7860
Invalid URI. Load of media resource  failed. 127.0.0.1:7860
Invalid URI. Load of media resource  failed. 127.0.0.1:7860
Invalid URI. Load of media resource  failed. 127.0.0.1:7860
Invalid URI. Load of media resource  failed. 127.0.0.1:7860
Invalid URI. Load of media resource  failed. 127.0.0.1:7860
Invalid URI. Load of media resource  failed. 127.0.0.1:7860
Invalid URI. Load of media resource  failed. 127.0.0.1:7860
Invalid URI. Load of media resource  failed. 127.0.0.1:7860
Invalid URI. Load of media resource  failed. 2 127.0.0.1:7860
Invalid URI. Load of media resource  failed. 2 127.0.0.1:7860
Invalid URI. Load of media resource  failed. 439 127.0.0.1:7860
Invalid URI. Load of media resource  failed. 657 127.0.0.1:7860
Invalid URI. Load of media resource  failed. 127.0.0.1:7860
Invalid URI. Load of media resource  failed. 127.0.0.1:7860
Invalid URI. Load of media resource  failed. 127.0.0.1:7860
Invalid URI. Load of media resource  failed. 127.0.0.1:7860
Invalid URI. Load of media resource  failed. 2 127.0.0.1:7860
Invalid URI. Load of media resource  failed. 2 127.0.0.1:7860
Invalid URI. Load of media resource  failed. 2 127.0.0.1:7860
Invalid URI. Load of media resource  failed. 2 127.0.0.1:7860
Invalid URI. Load of media resource  failed. 2 127.0.0.1:7860
Invalid URI. Load of media resource  failed. 2 127.0.0.1:7860
Invalid URI. Load of media resource  failed. 2 127.0.0.1:7860
Invalid URI. Load of media resource  failed. 1646 127.0.0.1:7860

System Info

Gradio Environment Information:
------------------------------
Operating System: Linux
gradio version: 4.26.0
gradio_client version: 0.15.1

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

aiofiles: 23.2.1
altair: 5.3.0
fastapi: 0.110.2
ffmpy: 0.3.2
gradio-client==0.15.1 is not installed.
httpx: 0.27.0
huggingface-hub: 0.22.2
importlib-resources: 6.4.0
jinja2: 3.1.2
markupsafe: 2.1.5
matplotlib: 3.8.4
numpy: 1.26.4
orjson: 3.10.0
packaging: 23.2
pandas: 2.2.2
pillow: 10.3.0
pydantic: 2.7.1
pydub: 0.25.1
python-multipart: 0.0.9
pyyaml: 6.0.1
ruff: 0.4.1
semantic-version: 2.10.0
tomlkit==0.12.0 is not installed.
typer: 0.12.3
typing-extensions: 4.11.0
uvicorn: 0.29.0
authlib; extra == 'oauth' is not installed.
itsdangerous; extra == 'oauth' is not installed.


gradio_client dependencies in your environment:

fsspec: 2024.2.0
httpx: 0.27.0
huggingface-hub: 0.22.2
packaging: 23.2
typing-extensions: 4.11.0
websockets: 11.0.3

Severity

Blocking usage of gradio

@mamei16 mamei16 added the bug Something isn't working label Apr 25, 2024
@mamei16 mamei16 changed the title Repeated "Invalid URI. Load of media resource failed." when recording audio in Firefox Repeated "Invalid URI. Load of media resource failed." when recording audio in Firefox leads to browser crash Apr 25, 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
Projects
None yet
Development

No branches or pull requests

1 participant