Summary:ASTERISK-00885: cdr_pgsql hangs up asterisk if postgresql dbms goes down
Reporter:Roy Sigurd Karlsbakk (rkarlsba)Labels:
Date Opened:2004-01-21 05:08:30.000-0600Date Closed:2008-01-15 14:41:56.000-0600
Versions:Frequency of
Environment:Attachments:( 0) cdr_pgsql.patch
Description:If cdr_pgsql is used with asterisk, and the postgresql database goes down, asterisk hangs up and needs to be killed with SIGKILL. It's enough to just restart the postgresql service. IMHO Asterisk should ingnore this, or even crash instead of just hanging.


Not all of Asterisk is hanging. the console seems to be working and my Nagios plugin logs in and out of the Manager to check if Asterisk is up. This did not detect any errors. All phone calls that were active at the time it crashed, stay marked as 'active' in 'show channels'
Comments:By: Brian West (bkw918) 2004-01-21 10:35:31.000-0600

cdr_odbc doesn't :P hehe


By: mdu113 (mdu113) 2004-01-21 15:26:28.000-0600

seems they forgot to unlock mutex if connection to db is broken.

By: Roy Sigurd Karlsbakk (rkarlsba) 2004-01-22 03:57:12.000-0600

Will this fix the issue?

By: mdu113 (mdu113) 2004-01-22 10:26:58.000-0600

it should. fixes for me. tested with postgres going down and back up multiple times.

By: Roy Sigurd Karlsbakk (rkarlsba) 2004-01-22 10:40:03.000-0600

I found the same results. Works fine :)
Thanks :)

By: Roy Sigurd Karlsbakk (rkarlsba) 2004-01-22 10:58:17.000-0600

Seems something's still missing. The call is stuck.
This was a lot later than when I tested restarting postgresql.

What I did was: dial cell phone, stop psql, hangup, dial cellphone, hangup, dial cell phone, start psql.

Now below is the hung channel, and noone can call in or out


pbx*CLI> show channels
       Channel  (Context    Extension    Pri )   State Appl.         Data      
  SIP/roy-6b2c  (internally 98013356     1   )    Ring (None)        (None)

edited on: 01-22-04 10:44

By: Brian West (bkw918) 2004-01-22 11:13:25.000-0600

Fixed in CVS

By: Brian West (bkw918) 2004-01-22 11:36:05.000-0600

Seems to have fixed a few but not all problems.

By: mdu113 (mdu113) 2004-01-22 12:06:32.000-0600

Just did what RoyK has described. Worked fine for me. What problems left?

By: Brian West (bkw918) 2004-02-09 00:13:10.000-0600

Let me know if this is still aproblem

By: Digium Subversion (svnbot) 2008-01-15 14:41:56.000-0600

Repository: asterisk
Revision: 2055

U   trunk/cdr/cdr_pgsql.c

r2055 | markster | 2008-01-15 14:41:55 -0600 (Tue, 15 Jan 2008) | 2 lines

Release pgsql on failure (bug ASTERISK-885)