gstreamer/subprojects
Nirbheek Chauhan 3bed35c342 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/6302>
2024-03-11 09:15:50 +00:00
..
gst-devtools Back to development 2024-03-05 12:58:57 +00:00
gst-docs Back to development 2024-03-05 12:58:57 +00:00
gst-editing-services ges: Fix critical warning 2024-03-08 21:00:51 +09:00
gst-examples Back to development 2024-03-05 12:58:57 +00:00
gst-integration-testsuites Back to development 2024-03-05 12:58:57 +00:00
gst-libav avviddec: Fix interlaced mode detection 2024-03-07 11:53:07 +00:00
gst-plugins-bad vkmemory: invalidate non-coherent memory when mapping for read 2024-03-11 01:55:44 +00:00
gst-plugins-base decodebin3: Provide clear error message if no decoders present 2024-03-11 09:17:09 +01:00
gst-plugins-good rtspsrc: Don't invoke close when stopping if we've started cleanup 2024-03-11 09:15:50 +00:00
gst-plugins-ugly Back to development 2024-03-05 12:58:57 +00:00
gst-python Back to development 2024-03-05 12:58:57 +00:00
gst-rtsp-server onvif: tests: check for T flag on all packets 2024-03-07 14:02:33 +00:00
gstreamer identity: Don't refuse seeks unless single-segment=true 2024-03-08 17:07:25 +11:00
gstreamer-sharp Back to development 2024-03-05 12:58:57 +00:00
gstreamer-vaapi Back to development 2024-03-05 12:58:57 +00:00
macos-bison-binary macos-bison: Update to 3.8.2 and add an ARM64 build 2023-08-31 07:50:43 +00:00
packagefiles aja: suppress compiler warnings for aja ntv2 subproject 2024-02-10 10:10:06 +00:00
win-flex-bison-binaries
win-nasm
win-pkgconfig
avtp.wrap
cairo.wrap cairo: update wrap to 1.18.0 2023-12-13 11:51:53 +00:00
dav1d.wrap
DirectX-Headers.wrap subprojects: Add DirectX-Headers wrap 2023-12-14 18:08:00 +09:00
directxmath.wrap directxmath.wrap: Fix cpuid mismatch on MinGW 2023-11-20 20:08:57 +00:00
dssim.wrap
dv.wrap
expat.wrap
fdk-aac.wrap
FFmpeg.wrap ffmpeg: Update subproject to 6.1 2024-02-23 13:24:22 +00:00
fontconfig.wrap
freetype2.wrap
fribidi.wrap
gl-headers.wrap
glib-networking.wrap
glib.wrap subprojects: update glib wrap to 2.78.3 2023-12-21 19:22:25 +02:00
gobject-introspection.wrap
graphene.wrap
gst-plugins-rs.wrap Back to development 2024-03-05 12:58:57 +00:00
gtk-sharp.wrap csharp: update gtk-sharp subproject 2023-12-07 17:34:30 +01:00
gtk.wrap
harfbuzz.wrap
json-glib.wrap
lame.wrap
libdrm.wrap
libffi.wrap
libgudev.wrap meson: Update libgudev wrap to 238 2023-12-06 20:17:56 +00:00
libjpeg-turbo.wrap
liblc3.wrap lc3: fix pkg-config file lookup 2023-08-08 22:12:29 +00:00
libmicrodns.wrap
libnice.wrap
libopenjp2.wrap
libpng.wrap
libpsl.wrap
libsoup.wrap soup: Link to libsoup in all cases on non-Linux 2024-02-21 09:27:59 +05:30
libsrtp2.wrap
libva.wrap
libwpe.wrap
libxml2.wrap
ntv2.wrap ntv2: Use a patch overlay instead of diff 2023-12-20 18:18:43 +00:00
ogg.wrap
openh264.wrap
opus.wrap
orc.wrap subprojects: track orc main branch again 2024-03-05 13:25:19 +00:00
pango.wrap pango: update wrap to 1.51.0 2023-12-13 11:51:53 +00:00
pcre2.wrap
pixman.wrap
proxy-libintl.wrap
pycairo.wrap
pygobject.wrap
sqlite3.wrap
vorbis.wrap
vpx.wrap subprojects: Add libvpx wrap 2023-08-08 18:08:24 +00:00
wayland-protocols.wrap gstwayland: Support wp_single_pixel_buffer_v1 2024-01-22 16:51:36 -05:00
webrtc-audio-processing.wrap meson: Update webrtc-audio-processing wrap to 1.3 2023-09-05 11:27:17 -04:00
wpebackend-fdo.wrap
x264.wrap subprojects: update x264 wrap to latest stable 164.3108 2024-02-02 14:46:06 +00:00
zlib.wrap