]> git.ipfire.org Git - thirdparty/asterisk.git/commit
channel.c: Fix unbalanced read queue deadlocking local channels. 83/4883/1
authorRichard Mudgett <rmudgett@digium.com>
Wed, 1 Feb 2017 00:28:15 +0000 (18:28 -0600)
committerRichard Mudgett <rmudgett@digium.com>
Thu, 2 Feb 2017 19:06:35 +0000 (13:06 -0600)
commit5c90c1e9f5fa2b9107e14461b130a4a3305a9135
tree5f20e31ad19527d99136d1517975342aeaacbcdf
parent5c2b7e34ff89579d6f2f27f6f26577ae06e0cba5
channel.c: Fix unbalanced read queue deadlocking local channels.

Using the timerfd timing module can cause channel freezing, lingering, or
deadlock issues.  The problem is because this is the only timing module
that uses an associated alert-pipe.  When the alert-pipe becomes
unbalanced with respect to the number of frames in the read queue bad
things can happen.  If the alert-pipe has fewer alerts queued than the
read queue then nothing might wake up the thread to handle received frames
from the channel driver.  For local channels this is the only way to wake
up the thread to handle received frames.  Being unbalanced in the other
direction is less of an issue as it will cause unnecessary reads into the
channel driver.

ASTERISK-26716 is an example of this deadlock which was indirectly fixed
by the change that found the need for this patch.

* In channel.c:__ast_queue_frame(): Adding frame lists to the read queue
did not add the same number of alerts to the alert-pipe.  Correspondingly,
when there is an exceptionally long queue event, any removed frames did
not also remove the corresponding number of alerts from the alert-pipe.

ASTERISK-26632 #close

Change-Id: Ia98137c5bf6e9d6d202ce0eb36441851875863f6
main/channel.c