GNOME Bugzilla – Bug 766645
matroskademux: don't hold object lock whilst pushing out headers, might lead to query deadlock
Last modified: 2016-05-19 21:07:31 UTC
matroskademux: Remove unnecessary lock condition matroska-demux has GST_OBJECT_LOCK in - gst_matroska_demux_push_codec_data_all() - gst_matroska_demux_query() Some parse element such as FLAC checks upstream seekability, and there is some use cases that matroska-demux is linked to a parse element (e.g.,FLAC format) without intermediate elements (e.g., queue). In this case, matroska-demux never get return of gst_matroska_demux_push_codec_data_all(), because the parse element can return it after the parse element receives return of upstream query.
Created attachment 328170 [details] [review] matroskademux: Remove unnecessary lock condition
Created attachment 328172 [details] log file Attached log file was captured using following commend gst-launch-1.0 filesrc location= mkv_H.264_FLAC.mkv ! matroskademux ! flacparse ! fakesink This file is too large for uploading... sorry.
Can be reproduced with: gst-launch-1.0 audiotestsrc num-buffers=1000 ! flacenc ! matroskamux ! filesink location=/tmp/flac.mkv gst-launch-1.0 filesrc location=/tmp/flac.mkv ! matroskademux ! flacparse ! fakesink
Thanks for the patch. I don't see any reason why the demuxer needs to take the lock here either, the variables should be sufficiently protected by the stream lock. And in general, elements should never hold the OBJECT_LOCK when pushing out buffers or events. In addition to that, if the GST_ELEMENT_ERROR() code path was ever hit, that would deadlock too. commit eb09829a1c1987373ae433daca6420ea6c0fb908 Author: Seungha Yang <sh.yang@lge.com> Date: Thu May 19 15:36:57 2016 +0900 matroskademux: don't hold object lock whilst pushing out headers matroskademux would take the GST_OBJECT_LOCK in - gst_matroska_demux_push_codec_data_all() - gst_matroska_demux_query() Some parse element such as FLAC checks upstream seekability, and there is some use cases that matroska-demux is linked to a parse element (e.g.,FLAC format) without intermediate elements (e.g., queue). In this case, matroska-demux never returns from _push_codec_data_all() because the parser can return only after it receives the response to the upstream query, but that's not going to happen because it's deadlocked. Elements must not hold the object lock whilst pushing out events or data. https://bugzilla.gnome.org/show_bug.cgi?id=766645