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 784967 - omx: Possible deadlock in gstomxaudioenc
omx: Possible deadlock in gstomxaudioenc
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-omx
1.12.2
Other All
: Normal critical
: 1.12.3
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2017-07-15 06:01 UTC by Satya Prakash Gupta
Modified: 2017-07-25 08:50 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch is attched (769 bytes, patch)
2017-07-17 08:21 UTC, Satya Prakash Gupta
committed Details | Review

Description Satya Prakash Gupta 2017-07-15 06:01:29 UTC
Hello All,

There is possible deadlock in gstomxaudioenc.c

File  : gst-omx/omx/gstomxaudioenc.c

In function "gst_omx_audio_enc_drain" at line: 1154

There if  g_mutex_lock (&self->drain_lock) at line: 1145 but incase of fails of gst_omx_port_release_buffer
Threre is no unlock of self->drain_lock.

below are snippet
err = gst_omx_port_release_buffer (self->enc_in_port, buf);
   if (err != OMX_ErrorNone) {
         GST_ERROR_OBJECT (self, "Failed to drain component: %s (0x%08x)",
         gst_omx_error_to_string (err), err);
         GST_AUDIO_ENCODER_STREAM_LOCK (self);
         return GST_FLOW_ERROR;
   }

Solution: There should be g_mutex_unlock (&self->drain_lock) in failure case;

Please check and provide your feedback.
Comment 1 Nicolas Dufresne (ndufresne) 2017-07-15 16:07:16 UTC
This is correct, do you want to provide a patch ?
Comment 2 Satya Prakash Gupta 2017-07-17 08:00:06 UTC
yes ... I am preparing a patch for it.. soon I will upload it.
Comment 3 Satya Prakash Gupta 2017-07-17 08:21:21 UTC
Created attachment 355740 [details] [review]
Patch is attched

Hi All, 

Please review attached patch and provide your feedback.
Comment 4 Sebastian Dröge (slomo) 2017-07-17 12:40:21 UTC
commit 9db720f13efaba8f8798e2796dba66e7a6c0f29a
Author: Satya Prakash Gupta <sp.gupta@samsung.com>
Date:   Mon Jul 17 13:44:54 2017 +0530

    omxaudioenc: Fix deadlock in error case when draining
    
    https://bugzilla.gnome.org/show_bug.cgi?id=784967