res_pjsip: Deny requests when threadpool queue is backed up.

We have observed situations where the SIP threadpool may become
deadlocked. However, because incoming traffic is still arriving, the SIP
threadpool's queue can continue to grow, eventually running the system
out of memory.

This change makes it so that incoming traffic gets rejected with a 503
response if the queue is backed up too much.

Change-Id: I4e736d48a2ba79fd1f8056c0dcd330e38e6a3816
This commit is contained in:
Mark Michelson
2015-11-11 17:11:53 -06:00
parent 7ae22c2690
commit 2f9cb7d62b
7 changed files with 44 additions and 7 deletions

View File

@@ -1397,3 +1397,8 @@ struct ast_taskprocessor *ast_threadpool_serializer(const char *name, struct ast
{
return ast_threadpool_serializer_group(name, pool, NULL);
}
long ast_threadpool_queue_size(struct ast_threadpool *pool)
{
return ast_taskprocessor_size(pool->tps);
}