Unable to create thread


#1

hello, everyone

i am using sip message dialplan and written that dialpan in /etc/asterisk/extensions_custom.conf
dialplan is:

[astsms]
exten => _X.,1,NoOp(SMS receiving dialplan invoked)
exten => _X.,n,NoOp(To {MESSAGE(to)}) exten => _X.,n,NoOp(From {MESSAGE(from)})
exten => _X.,n,NoOp(Body {MESSAGE(body)}) exten => _X.,n,Set(ACTUALTO={CUT(MESSAGE(to),@,1)})
exten => _X.,n,ExecIf(["{ACTUALTO}" != “sip:{EXTEN}"]?Set(ACTUALTO=sip:{EXTEN}))
exten => _X.,n,MessageSend({ACTUALTO},{MESSAGE(from)})
;exten => _X.,n,Set(FILE(/var/spool/asterisk/sms/{STRFTIME({EPOCH},%F-%T)}-{CALLERID(num)}-{EXTEN}.txt,a)={MESSAGE(body)}) exten => _X.,n,NoOp(Send status is {MESSAGE_SEND_STATUS})
exten => _X.,n,GotoIf(["{MESSAGE_SEND_STATUS}” != “SUCCESS”]?sendfailedmsg)
exten => _X.,n,Hangup()
;
; Handle failed messaging
exten => _X.,n(sendfailedmsg),NoOp(Sending error to user)
exten => _X.,n,Set(SRC={MESSAGE(from)}) exten => _X.,n,Set(DST={MESSAGE(to)})
exten => _X.,n,Set(MSG={MESSAGE(body)}) exten => _X.,n,Set(MESSAGE(body)="[{STRFTIME({EPOCH},,%d%m%Y-%H:%M:%S)}] Your message to {EXTEN} has failed. Sending when available")
exten => _X.,n,Set(ME_1={CUT(MESSAGE(from),<,2)}) exten => _X.,n,Set(ACTUALFROM={CUT(ME_1,@,1)})
exten => _X.,n,MessageSend({ACTUALFROM},ServiceCenter) exten => _X.,n,GotoIf(["{INQUEUE}" != "1"]?startq) exten => _X.,n,Hangup() ; exten => _X.,n(startq),NoOp(Queueing messaging for offline) exten => _X.,n,Set(MSGTIME={STRFTIME({EPOCH},,%d%m%Y-%H:%M:%S)}) ;exten => _X.,n,System(/bin/bash /var/lib/asterisk/agi-bin/sc.sh) exten => _X.,n,System(/bin/bash /var/lib/asterisk/agi-bin/astqueue.sh -s '{SRC}’ -d ‘{DST}' -m '{MSG}’)
exten => _X.,n,Hangup()
[app-fakeanswer]
exten => _X.,1,NoCDR
exten => _X.,n,Set(DESTDEV={EXTEN}) exten => _X.,n,Set(THISDEVSTATE={DEVICE_STATE(SIP/{DESTDEV})}) exten => _X.,n,GotoIf(["{THISDEVSTATE}" = "UNAVAILABLE"]?hang) exten => _X.,n,GotoIf(["{THISDEVSTATE}" = "UNKNOWN"]?hang) exten => _X.,n,GotoIf(["${THISDEVSTATE}" = “LAGGED”]?hang)
exten => _X.,n,Answer
exten => _X.,n,Hangup()
exten => _X.,n(hang),Hangup()

i got this issue when send more than 200 message simultaneously from single to single user.

[2019-01-08 07:05:02] WARNING[8086] pbx_spool.c: Unable to create thread (returned error: 11)
[2019-01-08 07:05:02] WARNING[8086] pbx_spool.c: Unable to create thread (returned error: 11)
[2019-01-08 07:05:02] WARNING[8086] pbx_spool.c: Unable to create thread (returned error: 11)
[2019-01-08 07:05:02] WARNING[8086] pbx_spool.c: Unable to create thread (returned error: 11)
[2019-01-08 07:05:02] WARNING[8086] pbx_spool.c: Unable to create thread (returned error: 11)
[2019-01-08 07:05:02] WARNING[8086] pbx_spool.c: Unable to create thread (returned error: 11)
[2019-01-08 07:05:02] WARNING[8086] pbx_spool.c: Unable to create thread (returned error: 11)
2019-01-08 07:05:02] WARNING[8086] pbx_spool.c: Unable to create thread (returned error: 11)
[2019-01-08 07:05:02] WARNING[8086] pbx_spool.c: Unable to create thread (returned error: 11)
[2019-01-08 07:05:02] WARNING[8086] pbx_spool.c: Unable to create thread (returned error: 11)
[2019-01-08 07:05:02] WARNING[8086] pbx_spool.c: Unable to create thread (returned error: 11)
[2019-01-08 07:05:02] WARNING[8086] pbx_spool.c: Unable to create thread (returned error: 11)
[2019-01-08 07:05:02] WARNING[8086] pbx_spool.c: Unable to create thread (returned error: 11)
[2019-01-08 07:05:02] WARNING[8086] pbx_spool.c: Unable to create thread (returned error: 11)
[2019-01-08 07:05:02] WARNING[8086] pbx_spool.c: Unable to create thread (returned error: 11)
[2019-01-08 07:05:02] WARNING[8086] pbx_spool.c: Unable to create thread (returned error: 11)
[2019-01-08 07:05:02] WARNING[8086] pbx_spool.c: Unable to create thread (returned error: 11)
[2019-01-08 07:05:02] WARNING[8086] pbx_spool.c: Unable to create thread (returned error: 11)
[2019-01-08 07:05:02] WARNING[8086] pbx_spool.c: Unable to create thread (returned error: 11)
[2019-01-08 07:05:02] WARNING[8086] pbx_spool.c: Unable to create thread (returned error: 11)
[2019-01-08 07:05:02] WARNING[58989] pbx.c: Failed to create new channel thread
[2019-01-08 07:05:02] WARNING[58973] pbx.c: Failed to create new channel thread
[2019-01-08 07:05:02] WARNING[58969] pbx.c: Failed to create new channel thread
[2019-01-08 07:05:02] WARNING[58978] pbx.c: Failed to create new channel thread
[2019-01-08 07:05:02] WARNING[58889] pbx.c: Failed to create new channel thread
[2019-01-08 07:05:02] WARNING[58991] pbx.c: Failed to create new channel thread
[2019-01-08 07:05:02] WARNING[58966] pbx.c: Failed to create new channel thread
[2019-01-08 07:05:02] WARNING[58985] pbx.c: Failed to create new channel thread
[2019-01-08 07:05:02] WARNING[58995] pbx.c: Failed to create new channel thread
[2019-01-08 07:05:02] WARNING[58895] pbx.c: Failed to create new channel thread
[2019-01-08 07:05:02] WARNING[58906] pbx.c: Failed to create new channel thread
[2019-01-08 07:05:02] WARNING[8086] pbx_spool.c: Unable to create thread (returned error: 11)
[2019-01-08 07:05:02] WARNING[58899] pbx.c: Failed to create new channel thread
[2019-01-08 07:05:02] WARNING[58976] pbx.c: Failed to create new channel thread
[2019-01-08 07:05:02] WARNING[58984] pbx.c: Failed to create new channel thread
[2019-01-08 07:05:02] WARNING[58993] pbx.c: Failed to create new channel thread
[2019-01-08 07:05:02] WARNING[58970] pbx.c: Failed to create new channel thread
[2019-01-08 07:05:02] NOTICE[59026] pbx_spool.c: Call failed to go through, reason (0) Call Failure (not BUSY, and not NO_ANSWER, maybe Circuit busy or down?)
[2019-01-08 07:05:02] WARNING[59029] pbx.c: Failed to create new channel thread
[2019-01-08 07:05:02] NOTICE[59029] pbx_spool.c: Call failed to go through, reason (0) Call Failure (not BUSY, and not NO_ANSWER, maybe Circuit busy or down?)
[2019-01-08 07:05:02] WARNING[59018] pbx.c: Failed to create new channel thread
[2019-01-08 07:05:02] NOTICE[59018] pbx_spool.c: Call failed to go through, reason (0) Call Failure (not BUSY, and not NO_ANSWER, maybe Circuit busy or down?)
[2019-01-08 07:05:02] WARNING[59019] pbx.c: Failed to create new channel thread
[2019-01-08 07:05:02] NOTICE[59019] pbx_spool.c: Call failed to go through, reason (0) Call Failure (not BUSY, and not NO_ANSWER, maybe Circuit busy or down?)
[2019-01-08 07:05:02] WARNING[59006] pbx.c: Failed to create new channel thread
[2019-01-08 07:05:02] NOTICE[59006] pbx_spool.c: Call failed to go through, reason (0) Call Failure (not BUSY, and not NO_ANSWER, maybe Circuit busy or down?)
[2019-01-08 07:05:02] WARNING[59032] pbx.c: Failed to create new channel thread
[2019-01-08 07:05:02] NOTICE[59032] pbx_spool.c: Call failed to go through, reason (0) Call Failure (not BUSY, and not NO_ANSWER, maybe Circuit busy or down?)
[2019-01-08 07:05:02] WARNING[59011] pbx.c: Failed to create new channel thread
[2019-01-08 07:05:02] NOTICE[59011] pbx_spool.c: Call failed to go through, reason (0) Call Failure (not BUSY, and not NO_ANSWER, maybe Circuit busy or down?)
[2019-01-08 07:05:02] WARNING[59020] pbx.c: Failed to create new channel thread
[2019-01-08 07:05:02] NOTICE[59020] pbx_spool.c: Call failed to go through, reason (0) Call Failure (not BUSY, and not NO_ANSWER, maybe Circuit busy or down?)
[2019-01-08 07:05:02] WARNING[59028] pbx.c: Failed to create new channel thread
[2019-01-08 07:05:02] NOTICE[59028] pbx_spool.c: Call failed to go through, reason (0) Call Failure (not BUSY, and not NO_ANSWER, maybe Circuit busy or down?)
[2019-01-08 07:05:02] WARNING[59015] pbx.c: Failed to create new channel thread
[2019-01-08 07:05:02] NOTICE[59015] pbx_spool.c: Call failed to go through, reason (0) Call Failure (not BUSY, and not NO_ANSWER, maybe Circuit busy or down?)

i have 200 users on this server. when more than 200 message request send within a second than cpu utilization is 100% and load average of server is around 50. at this stage asterisk stopped and server hanged up.
sometime dialplan missed the message request.

server: intel i5 with 4 core
RAM: 8GB
harddrive: 1TB

i dont know to handle the message request through dialpan and need help to resolve this problem.
please help me.