One Thread Per Peer

Home » Asterisk Users » One Thread Per Peer
Asterisk Users 1 Comment

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?

One thought on - One Thread Per Peer

  • 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 happening.
    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 –