[asterisk-bugs] [JIRA] (ASTERISK-25218) res_config_pgsql freezes asterisk at startup - "init table" request (function find_table) running infinitely

Roman (JIRA) noreply at issues.asterisk.org
Tue Nov 8 18:37:10 CST 2016


     [ https://issues.asterisk.org/jira/browse/ASTERISK-25218?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Roman updated ASTERISK-25218:
-----------------------------

    Status: Open  (was: Waiting for Feedback)

> res_config_pgsql freezes asterisk at startup - "init table" request (function find_table) running infinitely
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: ASTERISK-25218
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-25218
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: Resources/res_config_pgsql
>    Affects Versions: 13.4.0
>         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 datasource
>            Reporter: Roman
>            Assignee: Roman
>
> 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



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list