[Home]

Summary:ASTERISK-25218: res_config_pgsql freezes asterisk at startup - "init table" request (function find_table) running infinitely
Reporter:Roman Shubovich (rom1kz)Labels:
Date Opened:2015-06-30 17:27:06Date Closed:2017-02-23 14:44:20.000-0600
Priority:MajorRegression?
Status:Closed/CompleteComponents:Resources/res_config_pgsql
Versions:13.4.0 Frequency of
Occurrence
Frequent
Related
Issues:
Environment:postgresql server 9.4.4 asterisk 13.4.0 ubuntu server 14.04.02 LTS sip accounts & sip peers & queue_members configured as realtime with Postgresql datasourceAttachments:
Description:i have production server with about 400 sip accounts with short registration timeout for each (less or equals to 60 seconds).
and sometimes when i restart the asterisk server i see when * loads chan_sip or app_queue module then start process is freezes and nothing happens at all.
only "kill -9 pid" can help me to stop the process.

then i run gdb and run bt:
#5  0x00007f0855fe3add in _pgsql_exec (result=0x7fff241941a0,
   sql=0x1da3e28 "SELECT a.attname, t.typname, a.attlen, a.attnotnull, d.adsrc, a.atttypmod FROM (((pg_catalog.pg_class c INNER JOIN pg_catalog.pg_namespace n ON n.oid = c.re          lnamespace AND c.relname = 'queue_members' A"..., tablename=0x7fff24194430 "queue_members", database=0x7f08561f0700 <dbname> "voip") at res_config_pgsql.c:161
This "init table" request (function find_table) running infinitely

After reading lot of debug logs i see that right after init table request some of my sip accounts transmit a register message to the server and asterisk makes database request for select data. But init table answer not received by the module yet. Looking at source code of module res_config_pgsql i can see global variable PGconn *pgsqlConn and main function which uses this variable - pgsql_exec, for concurrence execution uses mutex pgsql_lock.
but issue has function find_table because he calls function pgsql_exec without locking the connection mutex

after adding lock to the find_table function the issue is gone
i hope this issue will be fixed in the next releases
Comments:By: Asterisk Team (asteriskteam) 2015-06-30 17:27:07.255-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: Rusty Newton (rnewton) 2015-07-01 13:36:36.850-0500

The res_config_pgsql module is under Extended Support. This means that the broader Asterisk community supports the module and not the core team.

If you want the fix to make it into the next release, the best thing to do is submit a patch with your proposed fix. See the [Patch Contribution Process|https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process].

Otherwise it'll be up to another community member to submit a patch and push it through the peer-review process.

By: Roman Shubovich (rom1kz) 2016-11-08 18:36:49.517-0600

the issue has been solved in last versions

By: Sean Bright (seanbright) 2017-02-23 14:44:20.297-0600

Based on your comments indicating that this is no longer a problem, this issue will be closed. If you continue to experience problems, please re-open this ticket.