[asterisk-users] One thread per peer

Matthew Jordan mjordan at digium.com
Sun Nov 9 18:14:32 CST 2014

On Sat, Nov 8, 2014 at 11:21 PM, CDR <venefax at gmail.com> wrote:
> Is this normal to create one thread per peer in Asterisk 12, chan_sip
> regular, not pjsip?
> What happens is I have 659 peers, and I get 682 tasks on
> ls /proc/15373/task | wc -l
> If this is normal then of course I can only get a few instances before my
> box collapses.
> Is it any different in pjsip?

I would hazard a guess to say that all three of your e-mails [1] [2]
(and this one) are the same problem. As such, I'll reply to this
thread and not the others.

Without seeing what in particular those threads are doing are how you
got the system into that state, it's impossible to say whether or not
the behaviour is expected. A few questions then:
1) Can you provide a scenario that reproduces this reliably? A sip
configuration (with a single peer) that results in a thread
'lingering' longer than anticipated would help to determine what is
2) Can you get a thread capture using gdb of a running Asterisk
process? That will inform us what the threads are actually doing when
this occurs. You can get instructions for getting a gdb backtrace from
the wiki [3], although the following should suffice:

# gdb -ex "thread apply all bt" --batch /usr/sbin/asterisk `pidof
asterisk` > backtrace-threads.txt

Thanks -


[1] http://lists.digium.com/pipermail/asterisk-users/2014-November/285083.html
[2] http://lists.digium.com/pipermail/asterisk-users/2014-November/285084.html
[3] https://wiki.asterisk.org/wiki/display/AST/Getting+a+Backtrace

Matthew Jordan
Digium, Inc. | Engineering Manager
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at: http://digium.com & http://asterisk.org

More information about the asterisk-users mailing list