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 macos-bison-binary: Remove warning when running on arm64 2022-12-16 23:58:07 +00:00
packagefiles/pango-1.50.12 meson: Add a patch that fixes pangocairo usage in gst-plugins-rs 2022-12-17 07:37:03 +05:30
win-flex-bison-binaries meson: Use run_command check: true for windows binary subprojects 2022-10-19 04:05:05 +00:00
win-nasm meson: Use run_command check: true for windows binary subprojects 2022-10-19 04:05:05 +00:00
avtp.wrap
bindinator.wrap
cairo.wrap subprojects: cairo: bump to 1.17.6 2022-09-17 22:41:40 +00:00
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 meson: Update some more wraps 2022-12-10 15:13:09 +00:00
fdk-aac.wrap
FFmpeg.wrap
fontconfig.wrap subprojects: fontconfig: bump to 2.14.0 2022-09-17 22:41:40 +00:00
freetype2.wrap Update all wraps from WrapDB 2022-09-23 11:08:06 -04:00
fribidi.wrap subprojects: fribidi: bump to 1.0.12 2022-09-17 22:41:40 +00:00
gl-headers.wrap
glib-networking.wrap subprojects: update glib-networking to 2.74.0 and switch to file wrap 2022-11-18 00:51:48 +00:00
glib.wrap subprojects: update glib to 2.74.1 2022-11-18 00:50:56 +00:00
graphene.wrap
gst-plugins-rs.wrap gst-plugins-rs: Track main branch again 2023-01-24 19:08:50 +00:00
gtk-sharp.wrap
gtk.wrap meson: Use gtk tarball for the subproject wrap 2023-02-01 06:29:11 +00:00
harfbuzz.wrap subprojects: harfbuzz: bump to 5.2.0 2022-09-17 22:41:40 +00:00
json-glib.wrap Update all wraps from WrapDB 2022-09-23 11:08:06 -04:00
lame.wrap meson: Update lame to -7 which contains the def file fix 2022-12-19 01:43:08 +05:30
libdrm.wrap Update all wraps from WrapDB 2022-09-23 11:08:06 -04:00
libffi.wrap subprojects: libffi: pin to meson-3.2.9999.4 tag 2022-12-31 13:49:17 +00:00
libgudev.wrap meson: Add a wrap file for libgudev 2023-04-19 22:47:19 +00:00
libjpeg-turbo.wrap Update all wraps from WrapDB 2022-09-23 11:08:06 -04:00
libmicrodns.wrap subprojects: libmicrodns: bump to 0.2.0 + meson fixes 2022-09-17 22:41:40 +00:00
libnice.wrap webrtc: Change requirement to libnice 0.1.20 2023-01-07 16:03:23 +00:00
libopenjp2.wrap meson: Update some more wraps 2022-12-10 15:13:09 +00:00
libpng.wrap
libpsl.wrap
libsoup.wrap subprojects: switch libsoup to a file wrap 2022-11-18 00:56:25 +00:00
libsrtp2.wrap subprojects: Update libsrtp2 wrap to v2.5.0 2023-02-01 10:34:35 +00:00
libwpe.wrap
libxml2.wrap libxml2.wrap: update to latest version 2023-01-25 11:38:52 +00:00
ogg.wrap Update all wraps from WrapDB 2022-09-23 11:08:06 -04:00
openh264.wrap Update all wraps from WrapDB 2022-09-23 11:08:06 -04:00
opus.wrap
orc.wrap subprojects: orc: bump to 0.4.33 2022-10-31 23:50:28 +00:00
pango.wrap meson: Add a patch that fixes pangocairo usage in gst-plugins-rs 2022-12-17 07:37:03 +05:30
pixman.wrap meson: Update some more wraps 2022-12-10 15:13:09 +00:00
proxy-libintl.wrap Update proxy-libintl wrap to 0.4 2022-04-22 15:36:40 +00:00
pycairo.wrap
pygobject.wrap meson: Allow sysdeps to be forced as fallback subprojects 2023-02-06 09:26:02 +00:00
sqlite3.wrap meson: Update some more wraps 2022-12-10 15:13:09 +00:00
vorbis.wrap meson: Update some wraps, remove unused wraps 2022-07-16 06:16:17 +00:00
webrtc-audio-processing.wrap
wpebackend-fdo.wrap
x264.wrap
zlib.wrap meson: Update some more wraps 2022-12-10 15:13:09 +00:00