[asterisk-dev] Another *8 deadlock :(

Steve Davies davies147 at gmail.com
Thu Jun 2 13:26:09 CDT 2011


On 2 June 2011 17:43, Gregory Nietsky <gregnietsky at gmail.com> wrote:
>
> Steve found this serves me well ....
>
>
>
>
> Index: main/channel.c
> ===================================================================
> --- main/channel.c      (.../trunk)     (revision 321557)
> +++ main/channel.c      (.../team/irroot/distrotech-customers-trunk)
>  (revision 321557)
> @@ -6493,8 +6501,12 @@
>         */
>        ao2_lock(channels);
>
> -       /* lock the original channel to determine if the masquerade is
> require or not */
> -       ast_channel_lock(original);
> +       /* lock the original channel with deadlock avoidance to determine if
> the masquerade is require or not */
> +       while (ast_channel_trylock(original)) {
> +               ao2_unlock(channels);
> +               usleep(1);
> +               ao2_lock(channels);
> +       }


That looks like a 1.8 upwards patch as you are ao2 locking channels,
but a solution for pre-1.8 cannot do that as channels and the channel
list are not ao2 objects (or are they?)

I am considering scheduling the channel destruction for after the
masquerade as an alternative to risky unlock and re-lock blocks.

Regards,
Steve



More information about the asterisk-dev mailing list