gstreamer/subprojects/gst-plugins-good/gst
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
..
alpha doc: Fix newline char between authors 2023-05-20 05:48:23 +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 dcaparse: keep upstream buffer meta 2023-11-14 16:51:44 +09: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 cutter: add audio-level-meta 2024-02-08 13:52:40 +00:00
debugutils taginject: Add scope property 2023-01-24 00:20:53 +00:00
deinterlace video-filters: Fix passthrough with ANY caps feature 2023-10-03 21:13:00 +00:00
dtmf rtpdtmfdepay: Classify as RTP element 2023-05-09 15:18:47 +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 flvdemux: don't re-use segment from one stream if the other has buffer earlier 2024-01-19 11:05:05 +01: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: Do not set channel-mask to zero 2024-03-07 12:52:30 +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 matroska-demux: Basic support for container-specific-track-id tag 2024-02-12 10:37:29 +00:00
monoscope meson: Call pkgconfig.generate in the loop where we declare plugins dependencies 2022-09-01 21:17:35 +00:00
multifile splitmuxsrc: Use natural ordering to find files 2024-01-24 20:15: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 rtpgstpay: flush on EOS 2024-03-07 14:02:33 +00:00
rtpmanager webrtc: add all SSRC attributes getting CAPS for a PT 2024-03-08 10:28:15 +00:00
rtsp rtspsrc: Don't invoke close when stopping if we've started cleanup 2024-03-11 09:15:50 +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: fix concurrent access when modifying the tag list 2023-07-25 15:18:05 +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: fix buffer leak with adtl tag 2023-11-03 19:38:38 +00:00
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