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 723851 - omxvideoenc/dec: Fix for a startup race condition
omxvideoenc/dec: Fix for a startup race condition
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-omx
git master
Other Linux
: Normal normal
: 1.2.0
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2014-02-07 14:20 UTC by deathsimple@vodafone.de
Modified: 2014-07-23 08:24 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Fix. (1.15 KB, patch)
2014-02-07 14:20 UTC, deathsimple@vodafone.de
reviewed Details | Review
Log of failure. (126.73 KB, text/x-log)
2014-02-25 13:49 UTC, deathsimple@vodafone.de
  Details
Log of failure. (121.45 KB, text/x-log)
2014-02-25 16:25 UTC, deathsimple@vodafone.de
  Details
Updated fix for the decoder. (1.04 KB, patch)
2014-03-01 17:55 UTC, deathsimple@vodafone.de
committed Details | Review
Same fix for the encoder. (1.04 KB, patch)
2014-03-01 17:56 UTC, deathsimple@vodafone.de
committed Details | Review

Description deathsimple@vodafone.de 2014-02-07 14:20:09 UTC
Created attachment 268414 [details] [review]
Fix.

Hi guys,

the attached patch is a simple fix for a race condition we encountered at startup.

The basic problem seems to be that the port who should get disabled because of reconfigure is still in the process of being enabled.

Please review and apply if approved,
Christian.
Comment 1 Sebastian Dröge (slomo) 2014-02-08 20:19:09 UTC
Comment on attachment 268414 [details] [review]
Fix.

Which other code was enabling the port if you get to this point? That line is only called if the decoder was not configured before, and in that case no other code should've enabled or disabled the output port yet.
Comment 2 deathsimple@vodafone.de 2014-02-10 10:26:01 UTC
(In reply to comment #1)
> (From update of attachment 268414 [details] [review])
> Which other code was enabling the port if you get to this point?

I don't have the slightest idea. We just got random "enabled/disabled pending" errors at startup from the following gst_omx_port_set_enabled call and adding this wait fixed it.
Comment 3 Sebastian Dröge (slomo) 2014-02-10 12:31:26 UTC
Can you get a debug log with GST_DEBUG=omx*:6 for such a case?
Comment 4 deathsimple@vodafone.de 2014-02-10 13:46:39 UTC
I will try, but trying to get a log always changed the timing for me and so made the bug hard to reproduce.

Leo was the only one who could reproduce the bug and get a trace log at the same time and so figured out where it came from.

The only thing I can assure you that after applying that patch we never had the issue again.
Comment 5 Sebastian Dröge (slomo) 2014-02-10 19:42:46 UTC
Can you get me that log? Or at provide a way to reproduce it (what hardware are you using?)?

Just the patch alone does not make much sense to me, I don't see how this situation could happen with the current code.
Comment 6 deathsimple@vodafone.de 2014-02-12 13:02:23 UTC
Let's drop this patch for now. It looks like we can't reproduce the issue anymore.

If I can get it to reproduce once more I will open up this bugreport again.
Comment 7 deathsimple@vodafone.de 2014-02-25 13:49:15 UTC
Created attachment 270274 [details]
Log of failure.

Took me a while, but I was able to reproduce this bug again.

Requested gst log with omx*:6 is attached.
Comment 8 deathsimple@vodafone.de 2014-02-25 14:41:15 UTC
Sorry, forget that log. That was a leftover from another run.

I'm still trying to reproduce the problem.
Comment 9 deathsimple@vodafone.de 2014-02-25 16:25:02 UTC
Created attachment 270294 [details]
Log of failure.

OK. Finally a clean log of the problem.
Comment 10 deathsimple@vodafone.de 2014-03-01 17:55:55 UTC
Created attachment 270634 [details] [review]
Updated fix for the decoder.

I figured out what the root cause of the problem is.

gst_omx_video_dec_reset and gst_omx_video_enc_reset doesn't check the state of the component before starting the src pad loop.

This results is that _set_format is trying to enable/disable the output port at the same time as the other task.
Comment 11 deathsimple@vodafone.de 2014-03-01 17:56:27 UTC
Created attachment 270635 [details] [review]
Same fix for the encoder.
Comment 12 Sebastian Dröge (slomo) 2014-03-02 11:08:59 UTC
commit 4e4f093319e9f28d242f42b4fee3a1ae1157920d
Author: Christian König <christian.koenig@amd.com>
Date:   Sat Mar 1 18:49:41 2014 +0100

    omxvideoenc: fix startup race condition
    
    The reset function shouldn't start the src pad
    loop if it wasn't started before.
    
    Signed-off-by: Christian König <christian.koenig@amd.com>

commit 0a8cfcde877b50a06a64f7ded4807707edeb1cd9
Author: Christian König <christian.koenig@amd.com>
Date:   Sat Mar 1 18:48:17 2014 +0100

    omxvideodec: fix startup race condition
    
    The reset function shouldn't start the src pad
    loop if it wasn't started before.
    
    Signed-off-by: Christian König <christian.koenig@amd.com>
Comment 13 Sebastian Dröge (slomo) 2014-03-02 11:09:25 UTC
Comment on attachment 270635 [details] [review]
Same fix for the encoder.

Thanks for the patches and debugging this annoying race condition :)