gstreamer/subprojects
Nirbheek Chauhan acd40e7852 rtspsrc: Don't invoke close when stopping if we've started cleanup
When we're doing a state change from PLAYING to NULL, first we invoke
gst_rtspsrc_loop_send_cmd_and_wait (..., CMD_CLOSE, ...) during
PAUSED_TO_READY which will schedule a TEARDOWN to happen async on the
task thread.

The task thread will call gst_rtspsrc_close(), which will send the
TEARDOWN and once it's complete, it will call gst_rtspsrc_cleanup()
without taking any locks, which frees src->streams.

At the same time however, the state change in the app thread will
progress further and in READY_TO_NULL it will call gst_rtspsrc_stop()
which calls gst_rtspsrc_close() a second time, which accesses
src->streams (without a lock again), which leads to simultaneous
access of src->streams, and a segfault.

So the state change and the cleanup are racing, but they almost always
complete sequentially. Either the cleanup sets src->streams to NULL or
_stop() completes first. Very rarely, _stop() can start while
src->streams is being freed in a for loop. That causes the segfault.

This is unlocked access is unfixable with more locking, it just leads
to deadlocks. This pattern has been observed in rtspsrc a lot: state
changes and cleanup in the element are unfixably racy, and that
foundational issue is being addressed separately via a rewrite.

The bandage fix here is to prevent gst_rtspsrc_stop() from accessing
src->streams after it has already been freed by setting src->state to
INVALID.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6346>
2024-03-12 19:22:47 +00:00
..
gst-devtools Back to development 2024-02-13 16:27:38 +00:00
gst-docs Back to development 2024-02-13 16:27:38 +00:00
gst-editing-services Back to development 2024-02-13 16:27:38 +00:00
gst-examples Back to development 2024-02-13 16:27:38 +00:00
gst-integration-testsuites Back to development 2024-02-13 16:27:38 +00:00
gst-libav Back to development 2024-02-13 16:27:38 +00:00
gst-omx Back to development 2024-02-13 16:27:38 +00:00
gst-plugins-bad wasapi2: Fix task memory leak 2024-03-08 22:11:31 +00:00
gst-plugins-base uridecodebin3: fix deadlock when switching input item 2024-03-08 19:49:05 +00:00
gst-plugins-good rtspsrc: Don't invoke close when stopping if we've started cleanup 2024-03-12 19:22:47 +00:00
gst-plugins-ugly Back to development 2024-02-13 16:27:38 +00:00
gst-python Back to development 2024-02-13 16:27:38 +00:00
gst-rtsp-server onvif: tests: check for T flag on all packets 2024-03-07 19:58:09 +00:00
gstreamer identity: Don't refuse seeks unless single-segment=true 2024-03-08 18:41:52 +00:00
gstreamer-sharp Back to development 2024-02-13 16:27:38 +00:00
gstreamer-vaapi Back to development 2024-02-13 16:27:38 +00:00
macos-bison-binary macos-bison: Update to 3.8.2 and add an ARM64 build 2023-09-07 21:36:15 +00:00
packagefiles meson: Ensure that soup plugin is built on Windows 2023-07-24 16:36:56 +01:00
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 subprojects/avtp: Update to latest avtp 0.2.0 2022-03-18 22:49:16 +00:00
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-10 15:12:54 +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 Back to development 2024-02-13 16:27:38 +00:00
gtk-sharp.wrap
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
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 subprojects/libpng: Update to latest wrap file 2022-01-28 02:01:39 +05:30
libpsl.wrap meson: Ensure that soup plugin is built on Windows 2023-07-24 16:36:56 +01:00
libsoup.wrap soup: Link to libsoup in all cases on non-Linux 2024-03-04 14:58:26 +00:00
libwpe.wrap
libxml2.wrap libxml2: update to 2.10.3-4 2023-07-24 15:36:34 +01: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: bump orc to 0.4.34 2023-06-15 10:14:55 +01: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-08 13:42:59 +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