[asterisk-bugs] [JIRA] (ASTERISK-25321) [patch]DeadLock ChanSpy with call over Local channel

Dirk Wendland (JIRA) noreply at issues.asterisk.org
Mon Feb 29 04:19:56 CST 2016


    [ https://issues.asterisk.org/jira/browse/ASTERISK-25321?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=229757#comment-229757 ] 

Dirk Wendland edited comment on ASTERISK-25321 at 2/29/16 4:19 AM:
-------------------------------------------------------------------

the main problem is in ast_autochan_destroy

I created log outputs from logging in this method. I added a parameter to get a workaround for the deadlock issue
autochan_destroy(struct ast_autochan *autochan,struct ast_channel *ast_autochan_chan)
so i locked on struct ast_channel *ast_autochan_chan
it seems that the deadlock is gone but itś only a workaround to get this maybe working in the next few days.
I think the channel structure is replaced during the answer of the local channel.

References struct ast_channel *ast_autochan_chan 0x7fbec0006ad8
References ->chan 0x7fbec0006ad8
ast_channel_lock(autochan->chan);
References struct ast_channel *ast_autochan_chan 0x7fbec0006ad8
References ->chan 0x7fbebc00c138

The old version in autochan.c
{NOFORMAT}
void ast_autochan_destroy(struct ast_autochan *autochan)
{
        struct ast_autochan *autochan_iter;

        ast_channel_lock(autochan->chan);
        AST_LIST_TRAVERSE_SAFE_BEGIN(ast_channel_autochans(autochan->chan), autochan_iter, list) {
                if (autochan_iter == autochan) {
                        AST_LIST_REMOVE_CURRENT(list);
                        ast_debug(1, "Removed autochan %p from the list, about to free it\n", autochan);
                        break;
                }
        }
        AST_LIST_TRAVERSE_SAFE_END;
        ast_channel_unlock(autochan->chan);

        autochan->chan = ast_channel_unref(autochan->chan);

        ast_free(autochan);
}
{NOFORMAT}

I hope that helps a little bit understanding and find a resolution for the problem and maybe a workaround for Jesper.



was (Author: kesselklopfer79):
the main problem is in ast_autochan_destroy

I created log outputs from logging in this method. I added a parameter to get a workaround for the deadlock issue
autochan_destroy(struct ast_autochan *autochan,struct ast_channel *ast_autochan_chan)
so i locked on struct ast_channel *ast_autochan_chan
it seems that the deadlock is gone but itś only a workaround to get this maybe working in the next few days.
I think the channel structure is replaced during the answer of the local channel.

References struct ast_channel *ast_autochan_chan 0x7fbec0006ad8
References ->chan 0x7fbec0006ad8
ast_channel_lock(autochan->chan);
References struct ast_channel *ast_autochan_chan 0x7fbec0006ad8
References ->chan 0x7fbebc00c138

The old version in autochan.c
{NOFORMAT}
void ast_autochan_destroy(struct ast_autochan *autochan)
{
        struct ast_autochan *autochan_iter;

        ast_channel_lock(autochan->chan);
        AST_LIST_TRAVERSE_SAFE_BEGIN(ast_channel_autochans(autochan->chan), autochan_iter, list) {
                if (autochan_iter == autochan) {
                        AST_LIST_REMOVE_CURRENT(list);
                        ast_debug(1, "Removed autochan %p from the list, about to free it\n", autochan);
                        break;
                }
        }
        AST_LIST_TRAVERSE_SAFE_END;
        ast_channel_unlock(autochan->chan);

        autochan->chan = ast_channel_unref(autochan->chan);

        ast_free(autochan);
}
{NOFORMAT}

I hope that helps a little bit understanding the problem and maybe a workaround for Jesper.


> [patch]DeadLock ChanSpy with call over Local channel
> ----------------------------------------------------
>
>                 Key: ASTERISK-25321
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-25321
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: Applications/app_chanspy
>    Affects Versions: 11.16.0, 11.18.0
>         Environment: custom CentOS 6 based distro
>            Reporter: Filip Frank
>            Assignee: Filip Frank
>            Severity: Critical
>         Attachments: asterisk.log_19082015_1258, backtrace-threads-ffr19082015_1258.txt, corelocks_ffr19082015_1258.txt, spydeadlock.patch
>
>
> We have a problem with ramdom deadlocks with using ChanSpy running on SIP channels, and dialing by AMI Originate to Local channel, which Dial another Local channel, and then Dial SIP peer. 
> Example: 1. SIP/iptel205 doing ChanSpy(SIP/iptel210)
>                2. AMI Originate Local/210 at dialer
>                3. Dial(Local/210 at internal)
>                4. Dial(SIP/iptel210)
>                5. Answer SIP/iptel210
>                6. Start dial caller from originate for ex 00420591122223 at outgoning
> Here is part of backtrace from coredump, I get it by gcore when asterisk was deadlocked.
> [Edit by Rusty - removed excessive debug from description. Please attach debug and annotated files to the issue with More > Attach Files]



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list