After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 772855 - decodebin3: Implement lock for multiqueue slot
decodebin3: Implement lock for multiqueue slot
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-base
git master
Other Linux
: Normal normal
: 1.10.0
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2016-10-13 12:07 UTC by Seungha Yang
Modified: 2016-10-31 14:35 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
decodebin3-Remove-trailing-whitespace (1.09 KB, patch)
2016-10-13 12:08 UTC, Seungha Yang
none Details | Review
decodebin3-Implement-lock-for-multiqueue-slot (8.01 KB, patch)
2016-10-13 12:09 UTC, Seungha Yang
none Details | Review
[LOG] Unexpected eos event (to multiqueue) (845.01 KB, text/x-log)
2016-10-13 12:15 UTC, Seungha Yang
  Details
decodebin3-More-SELECTION_LOCK-when-linking-to-slot (4.39 KB, patch)
2016-10-13 23:49 UTC, Seungha Yang
none Details | Review
decodebin3-Implement-lock-for-multiqueue-slot (4.39 KB, patch)
2016-10-13 23:52 UTC, Seungha Yang
committed Details | Review

Description Seungha Yang 2016-10-13 12:07:12 UTC
decodebin3: Implement lock for multiqueue slot

Since there can be multiple parsebin in a decodebin3, MultiQueueSlot
should be protected by lock
Comment 1 Seungha Yang 2016-10-13 12:08:53 UTC
Created attachment 337587 [details] [review]
decodebin3-Remove-trailing-whitespace
Comment 2 Seungha Yang 2016-10-13 12:09:22 UTC
Created attachment 337588 [details] [review]
decodebin3-Implement-lock-for-multiqueue-slot
Comment 3 Seungha Yang 2016-10-13 12:15:26 UTC
Created attachment 337596 [details]
[LOG] Unexpected eos event (to multiqueue)
Comment 4 Seungha Yang 2016-10-13 12:28:51 UTC
List of MultiQueueSlot (i.e., slots in decodebin3) and MultiQueueSlot itself should be protected by lock. There is a timing issue due to access to them without protection.

Please refer to the attached log.
When the problem happened, 

- output buffer of "parsebin1" was detected first (thread 0x8c400),
581 0:00:05.997468753 16257    0x8c400 FIXME             decodebin3 gstdecodebin3-parse.c:396:parsebin_buffer_probe:<decodebin3-0> Need a lock !
582 0:00:05.997525669 16257    0x8c400 DEBUG             decodebin3 gstdecodebin3-parse.c:398:parsebin_buffer_probe:<parsebin1:src_0> Got a buffer ! UNBLOCK 

- then, buffer of "parsebin0" (thread 0x8c800)
613 0:00:06.006743253 16257    0x8c800 FIXME             decodebin3 gstdecodebin3-parse.c:396:parsebin_buffer_probe:<decodebin3-0> Need a lock !
614 0:00:06.006764128 16257    0x8c800 DEBUG             decodebin3 gstdecodebin3-parse.c:398:parsebin_buffer_probe:<parsebin0:src_0> Got a buffer ! UNBLOCK !

- however, linking between "parsebin0" and multiqueue was done before that of "parsebin1", and it caused erroneous EOS event to multiqueue.
634 0:00:06.008808836 16257    0x8c800 INFO                GST_PADS gstpad.c:2498:gst_pad_link_full: linked parsebin0:src_0 and multiqueue0:sink_1, successful
637 0:00:06.010344211 16257    0x8c800 DEBUG             decodebin3 gstdecodebin3-parse.c:471:parsebin_buffer_probe:<multiqueue0:sink_0> Sending EOS to unused slot
638 0:00:06.007188878 16257    0x8c400 INFO                GST_PADS gstpad.c:2498:gst_pad_link_full: linked parsebin1:src_0 and multiqueue0:sink_0, successful
Comment 5 Seungha Yang 2016-10-13 23:49:51 UTC
Created attachment 337677 [details] [review]
decodebin3-More-SELECTION_LOCK-when-linking-to-slot

protecting a MultiQueueSlot may not be mandatory now.....
I made change to protect slots by taking SELECTION_LOCK
Comment 6 Seungha Yang 2016-10-13 23:52:37 UTC
Created attachment 337678 [details] [review]
decodebin3-Implement-lock-for-multiqueue-slot
Comment 7 Edward Hervey 2016-10-14 07:03:46 UTC
Indeed, iterating the slot list is already protected by the SELECTION lock (directly or implicitely) in the rest of decodebin3 code.

Thanks for that !

commit 5f2c0c8ea72e3376ff0d8367a92f8bb900f5a19b
Author: Seungha Yang <sh.yang@lge.com>
Date:   Thu Oct 13 20:10:09 2016 +0900

    decodebin3: More SELECTION_LOCK when linking to slot
    
    Since there can be multiple parsebin in a decodebin3,
    linking parsebin with MultiQueueSlot should be protected also.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=772855