]> git.ipfire.org Git - thirdparty/freeswitch.git/commit
[mod_conference] Avoid a race in member->read_impl access 2273/head
authorArun Raghavan <arun@asymptotic.io>
Thu, 12 Oct 2023 19:42:23 +0000 (15:42 -0400)
committerArun Raghavan <arun@asymptotic.io>
Tue, 7 Nov 2023 14:42:27 +0000 (09:42 -0500)
commitf05b7507aa28c1a320d839d5c65a72210050dc4d
tree410d7e243bd621a9544170f561def883b0df65dc
parent57fe9aa6b64a8d8fb854bb9ceb52fd9b681a79d9
[mod_conference] Avoid a race in member->read_impl access

The conference output loop accesses the member's read_impl while
resampling. The output loop also spawns off the input loop thread, which
is where the member->read_impl is actually initialised. This results in
an uncommon race where the output loop sometimes gets an uninitialised
member->read_impl and bails with logs something like this:

2023-10-12 18:19:01.436844 [DEBUG] conference_loop.c:1340 Setup timer soft success interval: 20  samples: 960 from codec L16
2023-10-12 18:19:01.436844 [DEBUG] conference_loop.c:1497 Outbound conference channel answered, setting CFLAG_ANSWERED
2023-10-12 18:19:01.436844 [NOTICE] switch_core_media.c:15852 Activating write resampler
2023-10-12 18:19:01.436844 [DEBUG] switch_core_media.c:16097 Engaging Write Buffer at 1920 bytes to accommodate 0->1920
2023-10-12 18:19:01.436844 [ERR] switch_core_media.c:16112 Write Buffer 0 bytes Failed!

As a solution, we initialise the member->read_impl even before we start
up the input loop, so that this race can never happen.
src/mod/applications/mod_conference/conference_loop.c