[Home]

Summary:ASTERISK-27992: PJSIP: Adding `sends_registrations = yes` to pjsip_wizard.conf causes crash
Reporter:Jonathan Harris (lardconcepts)Labels:pjsip
Date Opened:2018-07-28 16:50:20Date Closed:2018-07-28 16:57:50
Priority:MinorRegression?
Status:Closed/CompleteComponents:Resources/res_pjsip_config_wizard
Versions:13.22.0 15.5.0 Frequency of
Occurrence
Constant
Related
Issues:
Environment:Linux 4.15.0-29-generic #31-Ubuntu SMP Tue Jul 17 15:39:52 UTC 2018 x86_64 x86_64 x86_64 GNU/LinuAttachments:( 0) ASTERISK-27992.tar.zip
( 1) pjs_wiz.conf
Description:Adding `sends_registrations = yes` to pjsip_wizard.conf and reloading causes segfault. Asterisk will not start after that. In the syslog:

Jul 28 22:20:41 televox kernel: [   50.728769] asterisk[1504]: segfault at 0 ip 00007f4be3e00646 sp 00007ffc32067388 error 4 in libc-2.27.so[7f4be3d4f000+1e7000]

Removing the offending line allows asterisk to start.

There are no custom modules or flags - this is a straight build.
gcc version 7.3.0 (Ubuntu 7.3.0-16ubuntu3)

See attached stack trace
Comments:By: Asterisk Team (asteriskteam) 2018-07-28 16:50:23.426-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].

By: Jonathan Harris (lardconcepts) 2018-07-28 16:55:48.491-0500

Backtrace as generated following https://wiki.asterisk.org/wiki/display/AST/Getting+a+Backtrace

By: Jonathan Harris (lardconcepts) 2018-07-28 16:58:39.878-0500

Please re-open. Not closed

By: Asterisk Team (asteriskteam) 2018-07-28 16:58:39.990-0500

This issue has been reopened as a result of your commenting on it as the reporter. It will be triaged once again as applicable.

By: Richard Mudgett (rmudgett) 2018-07-31 10:56:22.955-0500

Please attach your pjsip_wizard.conf file you used to cause this.  It may be a combination of other values with the sends_registrations option.

By: Jonathan Harris (lardconcepts) 2018-07-31 11:18:48.373-0500

This is the offending pjsip_wizard.conf file. I have just tried pasting this into the pjsip_wizard file on a second machine (same specs) with the same version of Asterisk, and it also make that crash.
PS - if you see anything dodgy with any of my other config, please warn me! Thanks.

By: Richard Mudgett (rmudgett) 2018-07-31 12:25:23.011-0500

Yep.  I've reproduced the crash with the supplied [^pjs_wiz.conf] file.  Just uncomment the indicated line and you crash when asterisk loads.  It appears to be some combination of options that causes the crash.  As I'm not familiar with the wizard configuration method nor the code a fix is not obvious to me.

However, the sends_registrations option is used in other sections without a crash and there is a typo in the option names in that section:
{noformat}
outound_auth/username = XXXXXXXX@sip2sip.info
outound_auth/password = XXXXXXXX
{noformat}

Fixing the typo in outbound_auth also avoided the crash.

By: Jonathan Harris (lardconcepts) 2018-07-31 12:34:14.771-0500

Wow - well spotted @Richard. I hadn't seen that typo - tested and found to be working once typo fixed.
However, it does probably need to be a little more robust and not crash asterisk like that!

Many thanks for your diagnosis on this so far.

By: Richard Mudgett (rmudgett) 2018-07-31 12:38:40.407-0500

Yes that does need to be fixed as crashing is generally a bug that needs fixing. :)

By: Jonathan Harris (lardconcepts) 2018-07-31 12:39:24.628-0500

Ah, I've just made it crash again, this time by changing sends to accepts...

{noformat}
[sip2sip]
type = wizard
accepts_auth = yes
accepts_registrations = yes
transport = simpletrans
inbound_auth/username = XXXX
inbound_auth/password = XXXX
remote_hosts = 81.23.228.129,85.17.186.7,81.23.228.150,sip2sip.info
endpoint/allow = alaw
endpoint/context = fromvoipfone200
aor/max_contacts = 3
registration/contact_user = XXXX
outbound_proxy = proxy.sipthor.net
endpoint/language=en_GB
{noformat}

EDIT: I notice you changed the status to "minor" - I'm not sure that a typo in a config file bringing down an entire system is "minor"!.

By: Joshua C. Colp (jcolp) 2018-07-31 12:46:05.613-0500

It's minor because you can resolve the crash by fixing the configuration file or not using wizards.

By: Richard Mudgett (rmudgett) 2018-07-31 12:49:17.074-0500

Please attach the new backtraces as that is likely a different place in the code.  I just pasted what you put above into the [^pjs_wiz.conf] file section and it didn't crash on me.

By: Friendly Automation (friendly-automation) 2019-02-28 07:48:55.008-0600

Change 11061 merged by Joshua Colp:
res_pjsip_config_wizard: Don't crash if misconfigured

[https://gerrit.asterisk.org/c/asterisk/+/11061|https://gerrit.asterisk.org/c/asterisk/+/11061]

By: Friendly Automation (friendly-automation) 2019-02-28 07:49:27.620-0600

Change 11062 merged by Joshua Colp:
res_pjsip_config_wizard: Don't crash if misconfigured

[https://gerrit.asterisk.org/c/asterisk/+/11062|https://gerrit.asterisk.org/c/asterisk/+/11062]

By: Friendly Automation (friendly-automation) 2019-02-28 08:04:45.797-0600

Change 11060 merged by Joshua Colp:
res_pjsip_config_wizard: Don't crash if misconfigured

[https://gerrit.asterisk.org/c/asterisk/+/11060|https://gerrit.asterisk.org/c/asterisk/+/11060]