[Home]

Summary:ASTERISK-25702: PjSip realtime DB and Cache Errors since upgrade to asterisk-13.7.0 from asterisk-13.7.0-rc2
Reporter:Nic Colledge (nic)Labels:
Date Opened:2016-01-17 09:55:02.000-0600Date Closed:2016-02-03 10:17:41.000-0600
Priority:BlockerRegression?Yes
Status:Closed/CompleteComponents:Channels/chan_pjsip Core/Sorcery Resources/res_pjsip
Versions:13.7.0 Frequency of
Occurrence
Constant
Related
Issues:
Environment:Ubuntu 15.10 Linux 4.2.0-19-genericAttachments:( 0) ASTERISK-25702-13_7.diff
( 1) realtime_retrieve_regex.patch
Description:Hi guys,

Recently been doing some testing with 13.7.0-rc2 and then upgraded to 13.7.0. Having an issue with the following errors showing up on the console (with 13.7.0 but NOT with -rc2) relating to realtime pjsip / sorcery cache / odbc. These errors show up frequently (I think when the phone sends a register message)...

{noformat}
[Jan 17 15:23:12] WARNING[45435]: res_odbc.c:649 ast_odbc_prepare_and_execute: SQL Execute returned an error -1: 23505: ERROR: duplicate key value violates unique constraint "ps_contacts_id_key"
Key (id)=(XXXX^3B@72a0b3ea929375c2a0524bb43378a347) already exists.;
Error while executing the query (180)
[Jan 17 15:23:12] WARNING[45435]: res_odbc.c:661 ast_odbc_prepare_and_execute: SQL Execute error -1! Verifying connection to asterisk-ps-connector [asterisk-ps-connector]...
[Jan 17 15:23:12] WARNING[45435]: res_odbc.c:765 ast_odbc_sanity_check: Connection is down attempting to reconnect...
[Jan 17 15:23:12] NOTICE[45435]: res_odbc.c:1528 odbc_obj_connect: Connecting asterisk-ps-connector
[Jan 17 15:23:12] NOTICE[45435]: res_odbc.c:1567 odbc_obj_connect: res_odbc: Connected to asterisk-ps-connector [asterisk-ps-connector]
[Jan 17 15:23:12] WARNING[45435]: res_odbc.c:649 ast_odbc_prepare_and_execute: SQL Execute returned an error -1: 23505: ERROR: duplicate key value violates unique constraint "ps_contacts_id_key"
Key (id)=(XXXX^3B@72a0b3ea929375c2a0524bb43378a347) already exists.;
Error while executing the query (180)
[Jan 17 15:23:12] WARNING[45435]: res_odbc.c:661 ast_odbc_prepare_and_execute: SQL Execute error -1! Verifying connection to asterisk-ps-connector [asterisk-ps-connector]...
[Jan 17 15:23:12] WARNING[45435]: res_odbc.c:765 ast_odbc_sanity_check: Connection is down attempting to reconnect...
[Jan 17 15:23:12] NOTICE[45435]: res_odbc.c:1528 odbc_obj_connect: Connecting asterisk-ps-connector
[Jan 17 15:23:12] NOTICE[45435]: res_odbc.c:1567 odbc_obj_connect: res_odbc: Connected to asterisk-ps-connector [asterisk-ps-connector]
[Jan 17 15:23:12] ERROR[45435]: res_pjsip_registrar.c:504 rx_task: Unable to bind contact 'sip:XXXX@X.X.X.132:5060' to AOR 'XXXX'
[Jan 17 15:23:25] ERROR[45212]: res_sorcery_memory_cache.c:1559 sorcery_memory_cache_delete: Unable to delete object 'XXXX;@72a0b3ea929375c2a0524bb43378a347' from sorcery cache
[Jan 17 15:24:46] WARNING[45435]: res_odbc.c:649 ast_odbc_prepare_and_execute: SQL Execute returned an error -1: 23505: ERROR: duplicate key value violates unique constraint "ps_contacts_id_key"
Key (id)=(XXXX^3B@72a0b3ea929375c2a0524bb43378a347) already exists.;
{noformat}

Note that I have replaced the endpoint / aor names and IP addresses with X's.

I can provide configs if required but the exact same configs work without issue on the -rc2 release.

My odbc setup nothing special using a pgsql database. with a the schema created by alembic with one minor modification to work-around ASTERISK-25686 (int / double on qualify_timeout column).

sorcery.conf lines for contact / domain_alias / aor / auth / endpoint / identify all follow the pattern of:
{noformat}
contact/cache=memory_cache,expire_on_reload=yes,object_lifetime_maximum=1800
contact=realtime,ps_contacts
contact=config,pjsip.conf,criteria=type=contact
{noformat}
Please let me know if any further information is required to help with triage.

Thanks,
Nic.
Comments:By: Asterisk Team (asteriskteam) 2016-01-17 09:55:04.645-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].

By: Rusty Newton (rnewton) 2016-01-20 09:31:19.333-0600

Thanks for the report.

Please go ahead and provide complete configs (for odbc, pgsql, relevant Asterisk modules) and sanitize as necessary.

In addition provide another Asterisk log but include the DEBUG logger channel. Make sure verbose and DEBUG are both turned up to 5.

By: Chris Bloomfield (CBloomfield) 2016-01-22 09:49:56.074-0600

Hi,

I've been having the same issue as listed above in my test environment since upgrading from 13.7-rc2 to 13.7.

The attached patch appears to resolve the issue for me, while keeping the changes for ASTERISK-25689 intact.

By: Nic Colledge (nic) 2016-01-23 10:35:39.531-0600

Hi guys,

Just a bit of initial feedback; Chris Bloomfield's patch seems to do the trick and resolves this issue.I will keep an eye on the server over the next few days and report back.

Thanks,
Nic.

By: Mark Michelson (mmichelson) 2016-02-01 17:06:35.075-0600

Thanks for pointing out the problem. I've reproduced the problem and have also verified that the patch works. The problem here is that the patch needs to behave one way if the passed-in regex begins with ^, and it needs to behave differently if the passed-in regex does not begin with ^. A user notified us via github of a patch that they wrote that looks like it takes that into consideration. I've directed that person to upload the patch here. It's very similar to Chris Bloomfield's patch, but slightly different. Hopefully that person will upload their patch here soon.

By: Alexei Gradinari (alexei gradinari) 2016-02-02 09:02:36.169-0600

If the regex begins with '^' then strip it from SQL request.
If the regex doesn't begin with '^' then prepend SQL request with '%'.


By: Asterisk Team (asteriskteam) 2016-02-02 09:02:38.575-0600

The severity of this issue has been automatically downgraded from "Blocker" to "Major". The "Blocker" severity is reserved for issues which have been determined to block the next release of Asterisk. This severity can only be set by privileged users. If this issue is deemed to block the next release it will be updated accordingly during the triage process.

By: Joshua C. Colp (jcolp) 2016-02-02 09:05:38.971-0600

Well THAT was interesting. Oh well, back to blocker.

By: Mark Michelson (mmichelson) 2016-02-02 15:05:16.889-0600

This is now up for review at https://gerrit.asterisk.org/#/c/2150/