IAX2 Trunking - Max Trunk Data Space Exceeded

I am doing a stress test of various servers to see what peak call rates I may obtain on certain hardware profiles. When using IAX2 trunking I am getting these errors:

[quote=“CLI”]Feb 11 12:22:55 WARNING[3198]: chan_iax2.c:3732 iax2_trunk_queue: Maximum trunk data space exceeded to my_ip:4569
Feb 11 12:23:16 NOTICE[2902]: chan_iax2.c:2821 auto_congest: Auto-congesting call due to slow response
Feb 11 12:34:44 WARNING[2895]: channel.c:787 channel_find_locked: Avoided initial deadlock for ‘0x9e520a0’, 10 retries![/quote]

This is Asterisk v1.2.4 running on CentOS with 100 simultaneous calls on an AMD 3500 w/1GB of RAM. Any ideas what may be causing this?

According to the source, I see:

/Maximum trunk
if (tpeer) {
if (tpeer->trunkdatalen + f->datalen + 4 >= tpeer->trunkdataalloc) {
/* Need to reallocate space */
if (tpeer->trunkdataalloc < MAX_TRUNKDATA) {
tmp = realloc(tpeer->trunkdata, tpeer->trunkdataalloc + DEFAULT_TRUNKDATA + IAX2_TRUNK_PREFACE);
if (tmp) {
tpeer->trunkdataalloc += DEFAULT_TRUNKDATA;
tpeer->trunkdata = tmp;
ast_log(LOG_DEBUG, “Expanded trunk ‘%s:%d’ to %d bytes\n”, ast_inet_ntoa(iabuf, sizeof(iabuf), tpeer->addr.sin_addr), ntohs(tpeer->addr.sin_port), tpeer->trunkdataalloc);
} else {
ast_log(LOG_WARNING, “Insufficient memory to expand trunk data to %s:%d\n”, ast_inet_ntoa(iabuf, sizeof(iabuf), tpeer->addr.sin_addr), ntohs(tpeer->addr.sin_port));
ast_mutex_unlock(&tpeer->lock);
return -1;
}
} else {
ast_log(LOG_WARNING, “Maximum trunk data space exceeded to %s:%d\n”, ast_inet_ntoa(iabuf, sizeof(iabuf), tpeer->addr.sin_addr), ntohs(tpeer->addr.sin_port));
ast_mutex_unlock(&tpeer->lock);
return -1;
}
}

You are exceeding the MAX_TRUNKDATA limit, which is defined as:

chan_iax2.c:#define MAX_TRUNKDATA 640 * 200 /*!< 40ms, uncompressed linear * 200 channels */

You say you’re doing 100 calls, but I don’t know how many channels your box is actually using at that point. What does ‘iax2 show channels’ say?

Does this mean that IAX2 trunking has a set limit not related to the sizing of the box or bandwidth available? Will have to check on the channels with the next run.