gstreamer/subprojects/gst-plugins-good/gst/rtpmanager
François Laignel b9f7ab6052 rtpmanager/rtsession: data race leading to critical warnings
This is a fix for a data race leading to:

> GLib-CRITICAL: g_hash_table_foreach:
>   assertion 'version == hash_table->version' failed

Identified sequence:

* `rtp_session_on_timeout` acquires the lock on `session` and proceeds with its
  processing.
* `rtp_session_process_rtcp` is called (debug log : received RTCP packet) and
  attempts to acquire the lock on `session`, which is still held by
  `rtp_session_on_timeout`.
* as part of an hash table iterator, `rtp_session_on_timeout` transitively
  invokes `source_caps` which releases the lock on `session` so as to call
  `session->callbacks.caps`.
* Since `rtp_session_process_rtcp` was waiting for the lock to be released, it
  succeeds in acquiring it and proceeds with `rtp_session_process_rr` which
  transitively calls `g_hash_table_insert` via `add_source`.
* After `source_caps` re-acquires the lock and gives the control flow back to
  `rtp_session_on_timeout`, the hash table iterator is changed, resulting in the
  assertion failure.

This commits copies `sess->ssrcs[sess->mask_idx]` and iterates on the copy so
the iterator is not affected by a concurrent change due to the lock being
released in the `source_caps` callback.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4585>
2023-05-09 22:35:23 +00:00
..
gstrtpbin.c
gstrtpbin.h
gstrtpdtmfmux.c
gstrtpdtmfmux.h
gstrtpfunnel.c
gstrtpfunnel.h
gstrtphdrext-clientaudiolevel.c
gstrtphdrext-clientaudiolevel.h
gstrtphdrext-mid.c
gstrtphdrext-mid.h
gstrtphdrext-ntp.c
gstrtphdrext-ntp.h
gstrtphdrext-repairedstreamid.c
gstrtphdrext-repairedstreamid.h
gstrtphdrext-streamid.c
gstrtphdrext-streamid.h
gstrtphdrext-twcc.c
gstrtphdrext-twcc.h
gstrtpjitterbuffer.c
gstrtpjitterbuffer.h
gstrtpmanager.c
gstrtpmux.c
gstrtpmux.h
gstrtpptdemux.c rtpptdemux: set different stream-id on each src pad 2023-02-01 17:46:29 +00:00
gstrtpptdemux.h
gstrtprtxqueue.c
gstrtprtxqueue.h
gstrtprtxreceive.c
gstrtprtxreceive.h
gstrtprtxsend.c
gstrtprtxsend.h
gstrtpsession.c
gstrtpsession.h
gstrtpssrcdemux.c rtpssrcdemux: set different stream-id on each src pad 2023-02-01 17:46:29 +00:00
gstrtpssrcdemux.h
gstrtpst2022-1-fecdec.c
gstrtpst2022-1-fecdec.h
gstrtpst2022-1-fecenc.c
gstrtpst2022-1-fecenc.h
gstrtputils.c
gstrtputils.h
meson.build
rtpjitterbuffer.c
rtpjitterbuffer.h
rtpsession.c rtpmanager/rtsession: data race leading to critical warnings 2023-05-09 22:35:23 +00:00
rtpsession.h
rtpsource.c
rtpsource.h
rtpstats.c
rtpstats.h
rtptimerqueue.c
rtptimerqueue.h
rtptwcc.c twcc: Better handle duplicate packets 2023-04-10 13:16:44 +01:00
rtptwcc.h