[Home]

Summary:ASTERISK-28433: More than 1 AMI connection ends up dying
Reporter:Luke Escude (lukeescude)Labels:pjsip
Date Opened:2019-06-02 11:49:11Date Closed:2019-06-12 10:26:14
Priority:MinorRegression?
Status:Closed/CompleteComponents:Core/ManagerInterface
Versions:16.3.0 Frequency of
Occurrence
Related
Issues:
Environment:CentOS 7 x64Attachments:
Description:I'll need some help figuring out a proper diagnostic approach to help you guys out, since I don't have any ideas on how to recreate the issue consistently with valuable results. Anyways...

With a single AMI connection, the connection lasts forever - Ping, various commands, etc. the pipe never dies.

As soon as a second AMI connection forms to asterisk, it doesn't seem to survive - Meaning a Ping command (and all other commands) will suddenly stop returning any data. But, the socket doesn't seem to die.

A secondary issue is that some Originate commands will cause the AMI socket pipe to completely lock up for 10 seconds+ but I'd rather solve this issue first.

Any ideas on how to learn more details? The second AMI connection can typically last about a day, then drops off.

Interestingly, running 'manager show connected' after the second connection drops causes ALL further asterisk CLI output to not exist - The CLI will no longer push any information to the screen until you exit then re-enter the CLI again.
Comments:By: Asterisk Team (asteriskteam) 2019-06-02 11:49:16.154-0500

Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution.

A good first step is for you to review the [Asterisk Issue Guidelines|https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines] if you haven't already. The guidelines detail what is expected from an Asterisk issue report.

Then, if you are submitting a patch, please review the [Patch Contribution Process|https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process].

Please note that once your issue enters an open state it has been accepted. As Asterisk is an open source project there is no guarantee or timeframe on when your issue will be looked into. If you need expedient resolution you will need to find and pay a suitable developer. Asking for an update on your issue will not yield any progress on it and will not result in a response. All updates are posted to the issue when they occur.

By: Luke Escude (lukeescude) 2019-06-02 11:53:34.584-0500

I forgot steps to recreate:

1. Have an external program create a connection to AMI. This is Connection 1.

2. Have another (or same, doesn't matter) program create Connection 2 to the AMI.

3. Running 'manager show connected' will return both connections for about a day, and things will be fine during that time.

4. Some time later, the connection drops, but your external application doesn't seem to "realize" it for some reason, since I'm assuming the pipe doesn't die?

5. Running 'manager show connected' will show Connection 1 as still active, but you'll notice Connection 2 is gone. You will also notice that the asterisk CLI will generate no further output. pjsip show contacts, core show help, etc. all do not work.

6. Exit asterisk, re-enter, then CLI output works again until you call 'manager show connected' and it once again stops.

7. Kill and restart your external applications, and 'manager show connected' will show them both connected again like normal for about a day. Rinse and repeat.

By: Chris Savinovich (csavinovich) 2019-06-03 10:29:58.257-0500

Hello Luke, did you just say the issues on the second AMI login start about one full day after it's been connected? If so, I can think of a few reasons why things start going funny if you maintain an open connection that long. I would recommend you insert in your client code logic to send "keep alives" every x seconds.  Having said that, why would you want to maintain an AMI connection open that long? The efficient way to use AMI is to login send the request, get the response and logoff.  If you need to capture events then ARI is much better precisely because of its stateless nature.
Let us know if your issue persists even after taking the above measures.
Thanks


By: Luke Escude (lukeescude) 2019-06-10 17:38:42.645-0500

Chris,

Does the "Ping" "Pong" with asterisk count as a keepalive? If so, we're sending one every 15 seconds on both sockets.

Yes, we're definitely late to the ARI bandwagon. Currently we're using the primary connection for read-only monitoring of the PBX, and the secondary connection for origination.

Previously we were using the primary connection for origination too, but there's another bug that causes the socket to freeze up if you dial a wrong number - This is something I'll report when I learn more.

By: Chris Savinovich (csavinovich) 2019-06-11 11:26:09.913-0500

>>> " but there's another bug that causes the socket to freeze up if you dial a wrong number - This is something I'll report when I learn more..."

Please do.  In the meantime I am closing this ticket.
Best regards
Chris