Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • P PyAV
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 37
    • Issues 37
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 26
    • Merge requests 26
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • PyAV
  • PyAV
  • Issues
  • #1053
Closed
Open
Issue created Dec 02, 2022 by Administrator@rootContributor0 of 6 checklist items completed0/6 checklist items

container.close() holds GIL, causing deadlock when combined with pipe

Created by: ninja-

Overview

I have a PyAV stream that writes to output that is a unix pipe (mkfifo). When calling container.close(), libav waits for the other side to finish reading data written to pipe - as it should. Unfortunately, since the pipe consumer is another Python thread, that leads to deadlock during close(), as that thread can never read the last bits of data as container.close() holds the GIL.

The workaround I used is to push PyAV to "multiprocessing" process...

Expected behavior

There should be no GIL hold during calls to demux() or container.close()

Actual behavior

GIL is hold for container.close()

Build report:

Investigation

{{ What you did to isolate the problem. }}

Reproduction

Create a mkfifo file. Create two threads, one reads from the pipe, and other writes to it using PyAV container, and later does PyAV.close() See high chance of GIL deadlock during close()

Versions

  • OS: Linux
  • PyAV runtime: pip3 latest
  • PyAV build:
  • FFmpeg:

Research

I have done the following:

  • Checked the PyAV documentation
  • Searched on Google
  • Searched on Stack Overflow
  • Looked through old GitHub issues
  • Asked on PyAV Gitter
  • ... and waited 72 hours for a response.

Additional context

Assignee
Assign to
Time tracking