collabora / WhisperLive

A nearly-live implementation of OpenAI's Whisper.
MIT License
1.59k stars 214 forks source link

Deadlock with pipe_stderr=True in FFmpeg subprocess #245

Open sondt2709 opened 3 weeks ago

sondt2709 commented 3 weeks ago

Issue Summary: When using subprocess in Python with pipe_stderr=True but not reading from it, there are potential issues related to blocking behavior.

Steps to Reproduce:

  1. Increase max_connection_time to more than 10 mins to make sure it doesn't relate to websocket.
  2. Print log above and below line in_bytes = process.stdout.read(self.chunk * 2) in client.py
  3. Prepare a HLS stream url (i.e: https://example.com/stream.m3u8)
  4. Run and wait about 10-12 minutes

Expected Behavior: The subprocess should execute normally.

Actual Behavior: Hang forever at line in_bytes = process.stdout.read(self.chunk * 2)

Suggested Fix: Remove pipe_stderr=True or read stderr

Can I create a fix PR?

makaveli10 commented 3 weeks ago

@sondt2709 feel free to open a PR with the Fix. thanks!