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 781030 - alsasrc sometimes causes hanging.
alsasrc sometimes causes hanging.
Status: RESOLVED OBSOLETE
Product: GStreamer
Classification: Platform
Component: gst-plugins-base
git master
Other Linux
: Normal normal
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2017-04-07 11:45 UTC by Dag Gullberg
Modified: 2017-05-23 09:30 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
suggested patch (1.99 KB, patch)
2017-04-07 11:48 UTC, Dag Gullberg
none Details | Review
alsasrc added mutex locks (3.61 KB, patch)
2017-04-07 11:51 UTC, Dag Gullberg
none Details | Review

Description Dag Gullberg 2017-04-07 11:45:53 UTC
The Alsa driver requires serialized handling from clients on a given device handle, meaning that the client need to implement its own locking scheme for access.

From an application perspective, alsasrc is the place where this should be handled.

There are mutex locking in alsasrc, but it is not complete and seem to leave some openings for trouble.

A fix is suggested to add mutex locking on a few more functions.

It is an observed problem and the suggested patch solves it.
Comment 1 Dag Gullberg 2017-04-07 11:48:01 UTC
Created attachment 349462 [details] [review]
suggested patch

Initial suggested patch.
Comment 2 Dag Gullberg 2017-04-07 11:51:13 UTC
Created attachment 349463 [details] [review]
alsasrc added mutex locks

Original Patch
Comment 3 Sebastian Dröge (slomo) 2017-04-07 11:53:02 UTC
Did you check if the same problems are also in alsasink?
Comment 4 Sebastian Dröge (slomo) 2017-04-09 08:08:15 UTC
Also everything where you added the mutex would be called from the streaming thread if I'm not mistaken. Which other code paths can cause ALSA functions to be called from another thread at the same time?
Comment 5 Dag Gullberg 2017-04-18 10:45:22 UTC
The calls are typically from the ringbuffer in another thread.

Example situation:
One thread is in gst_audio_ring_buffer_release
Another is trying to do gst_alsasrc_get_timestamp()
The ringbuffer release code go via cb interface to eg. unprepare.
There is  a race situation that can be solved by using the present mutex in GstAudioSrc.

I have addressed a specific issue seen in our devices but it should perhaps be in place for alsasink as well.
Comment 6 Dag Gullberg 2017-05-23 09:03:25 UTC
When considering this patch further, we wish to withdraw it. It solve our problem, but we will consider another solution where the race conditions we see are altogether avoided (same thread).

Please remove or close this ticket.