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 789763 - appsink: test_query_drain unit test is racy
appsink: test_query_drain unit test is racy
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-base
git master
Other All
: Normal blocker
: 1.13.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2017-11-01 13:04 UTC by Tim-Philipp Müller
Modified: 2017-12-01 09:26 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
appsink: fix end condition of query drain handler (1.37 KB, patch)
2017-11-29 15:18 UTC, Julien Isorce
committed Details | Review

Description Tim-Philipp Müller 2017-11-01 13:04:02 UTC
+++ This bug was initially created as a clone of Bug #786739 +++

The new test_query_drain unit test added as part of the above bug appears to be racy. It fails sometimes on the ci:

appsink.test_query_drain:
Failure 'gst_app_sink_try_pull_sample (ctx->appsink, 0)' occurred
Comment 1 Tim-Philipp Müller 2017-11-01 13:21:04 UTC
Can be reproduced locally with:

 $ GST_CHECKS=test_query_drain make elements/appsink.forever
Comment 2 Julien Isorce 2017-11-01 23:38:41 UTC
Thx for reporting. I will have a look in the next weeks. As a temp measure we can either disable it or use the g_usleep from the first version of the test: https://bugzilla.gnome.org/attachment.cgi?id=358707&action=diff
Comment 3 Julien Isorce 2017-11-29 15:18:05 UTC
Created attachment 364623 [details] [review]
appsink: fix end condition of query drain handler

I thought it was a problem in the unit test but in the end it was a bug in the element, see commit message.
Comment 4 Julien Isorce 2017-11-29 16:10:42 UTC
Comment on attachment 364623 [details] [review]
appsink: fix end condition of query drain handler

commit 8af7b1f70b554ec25025a8c08c9f0dd14954923c
Author: Julien Isorce <jisorce@oblong.com>
Date:   Wed Nov 29 14:53:57 2017 +0000

    appsink: fix end condition of query drain handler
    
    The while loop should end when all buffers "and" the preroll
    buffer are consumed but this means to continue waiting if there
    are still some pending buffers "or" preroll buffer.
    
    The unit test was correct but racy because of this mistake.
    I.e. because of the wrong "and" the while could finish too early.
    
    cd tests/check && GST_CHECKS=test_query_drain make elements/appsink.forever
    
    https://bugzilla.gnome.org/show_bug.cgi?id=789763
Comment 5 Sebastian Dröge (slomo) 2017-12-01 08:07:30 UTC
Should this be backported to 1.12?
Comment 6 Julien Isorce 2017-12-01 09:26:37 UTC
(In reply to Sebastian Dröge (slomo) from comment #5)
> Should this be backported to 1.12?

This fixes something that is not on 1.12.