gstreamer/subprojects/gst-plugins-good/gst
François Laignel 5ef2ce69ff rtpmanager/rtsession: race conditions leading to critical warnings
While testing the [implementation for insertable streams] in `webrtcsink` &
`webrtcsrc`, I encountered critical warnings, which turned out to result from
two race conditions in `rtpsession`. Both race conditions produce:

> GLib-CRITICAL: g_hash_table_foreach:
>   assertion 'version == hash_table->version' failed

This commit fixes one of the race conditions observed.

In its simplest form, the test consists in 2 pipelines and a Signalling server:

* pipelines_sink: audiotestsrc ! webrtcsink
* pipelines_src: webrtcsrc ! appsrc

1. Set `pipelines_sink` to `Playing`.
2. The Signalling server delivers the `producer_id`.
3. Initialize `pipelines_src` to establish a session with `producer_id`.
4. Set `pipelines_src` to `Playing`.
5. Wait for a buffer to be received by the `appsrc`.
6. Set `pipelines_src` to `Null`.
7. Set `pipelines_sink` to `Null`.

The race condition happens in the following sequence:

* `webrtcsink` runs a task to periodically retrieve statistics from `webrtcbin`.
  This transitively ends up executing `rtp_session_create_stats`.
* `pipelines_sink` is set to `Null`.
* In `Paused` to `Ready`, `gst_rtp_session_change_state()` calls
  `rtp_session_reset()`.
* The assertion failure occurs when `rtp_session_reset` is called while
  `rtp_session_create_stats` is executing.

This is because `rtp_session_create_stats` acquires the lock on `session` prior
to calling `g_hash_table_foreach`, but `rtp_session_reset` doesn't acquire the
lock before calling `g_hash_table_remove_all`.

Acquiring the lock in `rtp_session_reset` fixes the issue.

[implementing insertable streams support]: https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1176

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4528>
2023-05-02 21:56:39 +00:00
..
alpha gst-plugins-good: re-indent with GNU indent 2.2.12 2023-03-17 03:18:54 +00:00
apetag gst-plugins-good: re-indent with GNU indent 2.2.12 2023-03-17 03:18:54 +00:00
audiofx gst-plugins-good: re-indent with GNU indent 2.2.12 2023-03-17 03:18:54 +00:00
audioparsers gst-plugins-good: re-indent with GNU indent 2.2.12 2023-03-17 03:18:54 +00:00
auparse meson: Call pkgconfig.generate in the loop where we declare plugins dependencies 2022-09-01 21:17:35 +00:00
autodetect meson: Call pkgconfig.generate in the loop where we declare plugins dependencies 2022-09-01 21:17:35 +00:00
avi gst-plugins-good: re-indent with GNU indent 2.2.12 2023-03-17 03:18:54 +00:00
cutter meson: Call pkgconfig.generate in the loop where we declare plugins dependencies 2022-09-01 21:17:35 +00:00
debugutils taginject: Add scope property 2023-01-24 00:20:53 +00:00
deinterlace deinterlace: Add support for high bitdepth planar YUV formats 2023-04-18 01:32:25 +09:00
dtmf dtmf: drop use of GSlice 2023-01-24 15:25:06 +00:00
effectv meson: Call pkgconfig.generate in the loop where we declare plugins dependencies 2022-09-01 21:17:35 +00:00
equalizer meson: Call pkgconfig.generate in the loop where we declare plugins dependencies 2022-09-01 21:17:35 +00:00
flv gst-plugins-good: re-indent with GNU indent 2.2.12 2023-03-17 03:18:54 +00:00
flx meson: Call pkgconfig.generate in the loop where we declare plugins dependencies 2022-09-01 21:17:35 +00:00
goom gst-plugins-good: re-indent with GNU indent 2.2.12 2023-03-17 03:18:54 +00:00
goom2k1 meson: Call pkgconfig.generate in the loop where we declare plugins dependencies 2022-09-01 21:17:35 +00:00
icydemux meson: Call pkgconfig.generate in the loop where we declare plugins dependencies 2022-09-01 21:17:35 +00:00
id3demux meson: Call pkgconfig.generate in the loop where we declare plugins dependencies 2022-09-01 21:17:35 +00:00
imagefreeze gst-plugins-good: re-indent with GNU indent 2.2.12 2023-03-17 03:18:54 +00:00
interleave meson: Call pkgconfig.generate in the loop where we declare plugins dependencies 2022-09-01 21:17:35 +00:00
isomp4 qtdemux: Fix segfault in cenc sample grouping 2023-05-02 11:32:01 +02:00
law meson: Call pkgconfig.generate in the loop where we declare plugins dependencies 2022-09-01 21:17:35 +00:00
level meson: Call pkgconfig.generate in the loop where we declare plugins dependencies 2022-09-01 21:17:35 +00:00
matroska matroskademux: Make gst_byte_reader_get_data() usage less confusing 2023-03-18 16:34:19 +02:00
monoscope meson: Call pkgconfig.generate in the loop where we declare plugins dependencies 2022-09-01 21:17:35 +00:00
multifile Revert "splitmuxsink: Avoid assertion when WAITING_GOP_COLLECT on reference context" 2023-04-28 11:00:19 +00:00
multipart meson: Call pkgconfig.generate in the loop where we declare plugins dependencies 2022-09-01 21:17:35 +00:00
replaygain meson: Call pkgconfig.generate in the loop where we declare plugins dependencies 2022-09-01 21:17:35 +00:00
rtp rtpjpegdepay: fix logic error when checking if an EOI is present 2023-03-24 19:39:33 +00:00
rtpmanager rtpmanager/rtsession: race conditions leading to critical warnings 2023-05-02 21:56:39 +00:00
rtsp rtspsrc: Fix handling of * control path 2023-04-27 13:47:56 +00:00
shapewipe meson: Call pkgconfig.generate in the loop where we declare plugins dependencies 2022-09-01 21:17:35 +00:00
smpte meson: Call pkgconfig.generate in the loop where we declare plugins dependencies 2022-09-01 21:17:35 +00:00
spectrum meson: Call pkgconfig.generate in the loop where we declare plugins dependencies 2022-09-01 21:17:35 +00:00
udp udpsrc: Add support for IGMPv3 SSM 2023-04-12 16:32:07 +00:00
videobox videocrop, videobox: Simplify navigation event handling and support touch events 2022-11-11 06:45:49 +00:00
videocrop videocrop, videobox: Simplify navigation event handling and support touch events 2022-11-11 06:45:49 +00:00
videofilter videoflip: check that stream actually changed when resetting 2023-04-22 14:03:16 +02:00
videomixer meson: Call pkgconfig.generate in the loop where we declare plugins dependencies 2022-09-01 21:17:35 +00:00
wavenc gst-plugins-good: re-indent with GNU indent 2.2.12 2023-03-17 03:18:54 +00:00
wavparse wavparse: Do not run all typefinders for all output 2022-11-16 10:32:25 +05:30
xingmux xingmux: drop use of GSlice 2023-01-24 15:25:06 +00:00
y4m meson: Call pkgconfig.generate in the loop where we declare plugins dependencies 2022-09-01 21:17:35 +00:00
meson.build xingmux: move from gst-plugins-ugly to gst-plugins-good 2022-10-25 12:40:20 +00:00