gstreamer/subprojects
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
..
gst-devtools validate: Add a way to avoid checking property value after setting it 2023-04-26 00:03:06 +00:00
gst-docs docs: update hotdoc theme to 0.15 2023-04-26 13:50:42 +02:00
gst-editing-services ges: Add test for the newly added DiscovererManager object 2023-04-29 06:54:10 -04:00
gst-examples examples: webrtc/janus/rust: add mandatory ws HTTP request headers 2023-03-22 09:48:28 +00:00
gst-integration-testsuites medias: Bump the medias commit 2023-04-05 13:38:30 -04:00
gst-libav libav: set the frame rate values in ffmpeg stream context 2023-04-27 06:45:26 +00:00
gst-omx doc: Avoid shelling out to hotdoc to generate plugins config files 2023-04-25 02:57:55 +00:00
gst-plugins-bad srt: assert instead of segfault when passing no error to ERROR_TO_WARNING 2023-05-02 21:01:45 +00:00
gst-plugins-base discover: Avoid double freee when creating info from cache file 2023-04-29 06:54:10 -04:00
gst-plugins-good rtpmanager/rtsession: race conditions leading to critical warnings 2023-05-02 21:56:39 +00:00
gst-plugins-ugly doc: Avoid shelling out to hotdoc to generate plugins config files 2023-04-25 02:57:55 +00:00
gst-python python: Use arch-specific install dir 2023-03-01 12:40:07 +00:00
gst-rtsp-server doc: Avoid shelling out to hotdoc to generate plugins config files 2023-04-25 02:57:55 +00:00
gstreamer pluginfeature: fix unexpected version check behaviour for git versions 2023-05-02 18:09:42 +00:00
gstreamer-sharp sharp: Mark _reserved fields as padding 2023-04-29 21:52:19 -04:00
gstreamer-vaapi meson: Fix libdrm and vaapi configure checks 2023-04-28 15:21:10 +05:30
macos-bison-binary
packagefiles/pango-1.50.12
win-flex-bison-binaries
win-nasm
avtp.wrap
bindinator.wrap
cairo.wrap
dav1d.wrap meson: add missing source_filename in the dav1d wrap 2023-04-03 14:29:36 +00:00
dssim.wrap
dv.wrap
expat.wrap
fdk-aac.wrap
FFmpeg.wrap
fontconfig.wrap
freetype2.wrap
fribidi.wrap
gl-headers.wrap
glib-networking.wrap
glib.wrap
graphene.wrap
gst-plugins-rs.wrap
gtk-sharp.wrap
gtk.wrap
harfbuzz.wrap
json-glib.wrap
lame.wrap
libdrm.wrap
libffi.wrap
libgudev.wrap meson: Add a wrap file for libgudev 2023-04-19 22:47:19 +00:00
libjpeg-turbo.wrap
libmicrodns.wrap
libnice.wrap
libopenjp2.wrap
libpng.wrap
libpsl.wrap
libsoup.wrap
libsrtp2.wrap
libwpe.wrap
libxml2.wrap
ogg.wrap
openh264.wrap
opus.wrap
orc.wrap
pango.wrap
pixman.wrap
proxy-libintl.wrap
pycairo.wrap
pygobject.wrap
sqlite3.wrap
vorbis.wrap
webrtc-audio-processing.wrap
wpebackend-fdo.wrap
x264.wrap
zlib.wrap