Autoservice.c: Exceeded maximum number of automatic monitoring events

We were stress testing our asterisk server for large number of concurrent calls by dialing using originate to another server and playing a file. Initial calls go well but after this we start getting this warning.

WARNING[513148][C-00002cec] autoservice.c: Exceeded maximum number of automatic monitoring events. Fix autoservice.c

We are testing by recording the call at the other end and playing the files randomly. For around 5000 calls the recordings seem to be fine, but we still get this warning anyway. Should we be worried or can this be safely ignored? What does this service do?

Thanks :slight_smile:

Autoservice is run on a channel when there is longish running processing on the channel which isn’t itself, monitoring media and other events arriving on the channel. It stops internal queues filling up with media that is going to be discarded.

Subject to actually checking the code, I suspect the message means that more events, other than media arrived. As I recall, these are normally played out once normal processing continues.

So the long running process I think would be the Dial function. We have a fastagi server in python which dials out and triggers a playback using a post-answer GoSub. The GoSub just calls the Playback function over a file.

PJSIP/test,,gU(playback_gosub)

So, there are around 5000 long running Dial running.
The calls seems to complete fine though.

these are normally played out once normal processing continues.

So, should I ignore these warnings or anything I can do to fix this besides avoiding such sort of load on this server?

Not the whole of Dial. I’m not sure what in Dial would trigger it in your case, as the only two places I can see in the code are during pre-dial subroutines and privacy processing. I think the latter is the anti-telemarketing stuff, but I didn’t investigate it closely.

I think I would have expected it to be run on the A side during your gosub, but I could only find two places in the code where autoservice_start() was called.

For most of the time in Dial, all events (frames) need to be handled, either by Dial itself, or by the bridge.

You are right about the GoSub. I removed the post-answer GoSub which had playback, and didn’t get the errors in that case. So the subroutine is the cause of it.
How can I fix this? What is the expected way to do this I mean. MAX_AUTOMONS is set to 1500 and exceeding it triggers this warning.

What I’m testing for is how many users can I dial to at a time to see how many calls can the server handle. So for this I just have a test user on another asterisk server and I originate calls from my current server using a loop, and a playback is triggered on answer(extension on second server answers and waits for 200 seconds).
So should I just expect this warning and ignore it(calls seem to run fine and completely)? Or compile again with a custom value for MAX_AUTOMONS, if that’s even recommended?
Thanks a lot :slight_smile:

You can increase the MAX_AUTOMONS value. When it is exceeded you have more channels in autoservice than it can monitor. That means that those channels are not handling incoming frames and you could then start getting the “Exceptionally long queue length queuing to chan” warnings on those unserviced channels. I do want to caution about increasing the value to a ridiculous amount (like 10000) as there may be some other system limit that you could run into.

I imagine why it appears to work with the autoservice warning is that as channels leave autoservice they make room for any channels over the limit to get serviced until enough room is available.

Thanks @rmudgett I’ll be setting it to maybe 5000 then. On what parameters can I decide a safe value for this though?
If it’s useful, we are using Xeon E-2224 4-core server with 16GB ram.

I doubt anyone has done the design calculations in over a decade, so there is probably no-one who really knows what will break first. I’d think you would need to examine the source code and work out what resources it needs, including whether it O(n^2) or worse, on CPU load.

Thanks @david551. I’ll have to wing it I guess as studying the code would take a lot of time as I’m not experienced in C. I’ll try to observe how it behaves for different values. Thanks :slight_smile:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.