[Home]

Summary:ASTERISK-28857: #exec call in pjsip.conf causes large delay (60 seconds) when reloading pjsip, partially locks up dialplan.
Reporter:Steve Sether (stevesether)Labels:config
Date Opened:2020-04-27 16:39:30Date Closed:
Priority:MajorRegression?
Status:Open/NewComponents:Core/Configuration Resources/res_pjsip
Versions:16.9.0 Frequency of
Occurrence
Constant
Related
Issues:
Environment:Centos 6.9.Attachments:( 0) generate.sh
( 1) pjsip_peers_part.conf
( 2) pjsip.conf
Description:We use a #exec statement at the end of our pjsip.conf file to generate sip peers.  The list is somewhat long, and takes about 4 seconds to generate.

When I use a #exec in the pjsip.conf to generate my sip peers, and do a pjsip reload, Asterisk will stop processing certain commands (The dial function for instance), the console shows no progress,  and Asterisk takes a full 60 seconds to reload pjsip.  When I generate the same contents statically, and do a pjsip reload, it reloads in under a second, and doesn't lock anything up.

This is fairly easy to reproduce, and has something to do with the script executing taking a few seconds to complete.  If I simulate a 4 second pause that my script takes to generate sip peers, I can reproduce this behavior.

#!/bin/sh
cat /root/pjsip_peers_part.conf
sleep 4

I get essentially the same results where pjsip locks up.  The length of /root/sippers.conf can be trivially short.  Example config files attached.

This was not an issue for the #execute command in sip.conf in Asterisk 11.
Comments:By: Asterisk Team (asteriskteam) 2020-04-27 16:39:32.200-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: Steve Sether (stevesether) 2020-04-27 16:44:18.511-0500

Files to simulate this bug.

By: Kevin Harwell (kharwell) 2020-04-27 17:36:32.275-0500

Interestingly removing the sleep for me makes it load fine (well timely I guess). However it does seem to take much longer than the specified sleep time when included.

I even did the following:
{noformat}
#!/bin/bash
sleep 0.1
cat <<EOF
[hai](aor_t)
mailboxes=hai@default

[hai](auth_t)
username=hai

[hai](endpoint_t)
aors=hai
auth=hai

EOF
{noformat}
And there was still a noticeable load delay.

By: Steve Sether (stevesether) 2020-04-28 09:18:40.153-0500

Yes, I played around a little with the length of sleep.  Sleeping 1 second seems to take about 15 seconds to load.

By: Sean Bright (seanbright) 2020-09-11 16:06:56.858-0500

It's because pjsip.conf is being parsed ~15 times (and the script is, in turn, being executed ~15 times).

By: Steve Sether (stevesether) 2020-12-16 15:20:10.592-0600

It's worth noting that I created a workaround for this that generates the pjsip.conf through a shell script, and then do a reload pjsip.  The list is exactly the same, but I don't get any dialplan lockup like I do when the list takes time to generate.