[Home]

Summary:ASTERISK-28649: Segfault: ast_variables_destroy #channel_vars #set_var #sorcery_realtime
Reporter:John Bowen (jbowen7@gmail.com)Labels:
Date Opened:2019-12-04 14:22:31.000-0600Date Closed:2019-12-05 13:13:05.000-0600
Priority:MajorRegression?Yes
Status:Closed/CompleteComponents:Resources/res_realtime
Versions:16.5.0 16.6.2 Frequency of
Occurrence
Constant
Related
Issues:
is related toASTERISK-28112 Asterisk is not able to use newly released mysql connector odbc 8.0.12 for voicemail
Environment:CentOS Linux release 7.6.1810 (Core) 3.10.0-957.27.2.el7.x86_64 Asterisk build: asterisk-16.6.2 Alembic Version: 3a094a18e75bAttachments:( 0) core.28564-brief.txt
( 1) core.28564-full.txt
( 2) core.28564-locks.txt
( 3) core.28564-thread1.txt
Description:Using sorcery realtime, if the column ps_endpoints.set_var` contains more than 16 characters a segfault occurs during the loading of endpoints.

This, however, does not occur when statically defining endpoints in pjsip.conf.

Reproduce with:
1) Create three endpoints (odbc, realtime)
2) UPDATE ps_endpoints SET set_var = 'abc=1234567890abc' WHERE id is NOT NULL
3) Reload asterisk

Notes:
- All 3 endpoints must have channel_vars > 16 characters, the issue is not reproducable if only 2 endpoints have channel_vars > 16 chars
- This issue was not present in 13.17.2 (using pjsip bundled)

I'll be posting my findings as I dig into the code, but wanted to make core and other users aware of the issue first.
Comments:By: Asterisk Team (asteriskteam) 2019-12-04 14:22:32.600-0600

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: John Bowen (jbowen7@gmail.com) 2019-12-04 18:34:49.700-0600

This might be a problem in ODBC. (if it is, i'll close the issue soon)

When I alter the column type from TEXT -> VARCHAR(255) the segfault no longer occurs.
LONGTEXT and TEXT both produce the segfault, whereas VARCHAR does not.
Disregard "This issue was not present in 13.17.2 (using pjsip bundled)", since I was using different ODBC drivers.

I'll report more findings shortly

Installed:

Name        : unixODBC
Arch        : x86_64
Version     : 2.3.1
Release     : 11.el7
From repo   : base

Name        : unixODBC-devel
Arch        : x86_64
Version     : 2.3.1
Release     : 11.el7
From repo   : base

Name        : mysql-connector-odbc
Arch        : x86_64
Version     : 8.0.18
Release     : 1.el7
From repo   : mysql-connectors-community




By: John Bowen (jbowen7@gmail.com) 2019-12-04 22:57:01.830-0600

More info:
When logging the values in "pjsip_configuration.set_var_handler" I see the values appear to be identical with both column types: TEXT and VARCHAR. However, when I switch to VARCHAR, a call to set_var_to_str occurs, whereas with TEXT it does not.



By: Sean Bright (seanbright) 2019-12-05 08:17:16.331-0600

Pretty sure this is the same bug as the linked issue ASTERISK-28112.

Per [the MySQL bug linked from the other issue|https://bugs.mysql.com/bug.php?id=92947], setting {{NO_SSPS = 1}} in your {{odbc.ini}} file might resolve the issue. It did in my tests.


By: John Bowen (jbowen7@gmail.com) 2019-12-05 13:07:49.267-0600

@Sean, my preliminary tests show that adding `NO_SSPS =1` does indeed resolve the issue.

Can't say I know why yet, but all fingers are pointing at the driver.
I'm going to go ahead and close this