[Home]

Summary:ASTERISK-14356: [patch] realtime mysql status always shows connected for 0 seconds/no connection
Reporter:Marcin Kowalczyk (kowalma)Labels:
Date Opened:2009-06-22 06:31:29Date Closed:2009-07-06 16:37:41
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Addons/res_config_mysql
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) 20090628__issue15375.diff.txt
( 1) ast_test
( 2) messages
Description:I've found issue with DB connection.

Asterisk-node1(active):/usr/src#  rasterisk  -x "realtime mysql status"
general connected to asterisk@127.0.0.1, port 3306 with username cdr for 0 seconds.
Asterisk-node1(active):/usr/src#

shows always 0 seconds. Sometime rt shows that there is no db connection (and then sip show peers show no sip-peer configured) but DB is queried
Comments:By: Marcin Kowalczyk (kowalma) 2009-06-22 07:34:01

Now happened following:

Asterisk-node1*CLI> realtime mysql status
Asterisk-node1*CLI> realtime mysql status
Asterisk-node1*CLI> realtime mysql status
Asterisk-node1*CLI> realtime mysql status
Asterisk-node1*CLI> realtime mysql status
Asterisk-node1*CLI> realtime mysql status
Asterisk-node1*CLI> my

and I'm not able to type anything on CLI. Only solution is to kill asterisk CLI (but only CLI) and then CLI will work again.

That time realtime does not query MySQL - last check I had 6mins ago:

090622 14:27:29      42 Init DB     asterisk
                    42 Query       UPDATE sipfriends SET lastms = '-1' WHERE name = '1064'
                    42 Init DB     asterisk
                    42 Query       SELECT * FROM sipfriends WHERE name = '1064'

By: uros gaber (urosh) 2009-06-22 16:39:56

Hi.
I can confirm this. Server runs on Ubuntu 32-bit, Asterisk 1.6.1.1

Asterisk hang-up occasional, but when I type in CLI realtime mysql status, or realtime mysql chache it just hangs up. The calls from phones doesn't work. Nothing at all.

By: Sebastian Gutierrez (sum) 2009-06-22 16:45:58

I can confirm  for  SVN-branch-1.6.2-r194360M

By: uros gaber (urosh) 2009-06-23 05:06:09

The problem for solving this issue is that in log/asterisk/messages isn't any suspicious error warning. I can attach it if you want.

By: Marcin Kowalczyk (kowalma) 2009-06-23 05:24:16

I also did not find anything suspicious in logs...

By: uros gaber (urosh) 2009-06-23 14:33:05

kowalma is it possible for you, that reported issue, to change priority to major?

By: Marcin Kowalczyk (kowalma) 2009-06-23 14:46:38

Nope. I cannot

By: uros gaber (urosh) 2009-06-23 15:20:40

Kowalma I uploaded script which I use to check if Asterisk is running ok. If Asterisk hangs up script restarts it.


I hope that developers can find the solution for this problem.



By: Marcin Kowalczyk (kowalma) 2009-06-23 15:27:11

Restarting * is not solution.
I'm developing new version of * and for now I found two bugs in 1.6.1.1

I think I will consider downgrade to 1.6.0 branch.

By: Leif Madsen (lmadsen) 2009-06-24 13:48:36

As a possible work around, I would highly suggest you use ODBC connections and not the res_config_mysql module from addons as ODBC is more highly supported.

By: uros gaber (urosh) 2009-06-25 05:20:06

Hi again. I uploaded some of my last messages before asterisk stoped responding and my script restarted it.

[Jun 25 12:08:53] DEBUG[16207] chan_sip.c: Allocating new SIP dialog for 196084755@192_168_1_133 - REGISTER (No RTP)
[Jun 25 12:08:53] DEBUG[16207] chan_sip.c: **** Received REGISTER (2) - Command in SIP REGISTER
[Jun 25 12:08:53] DEBUG[16207] chan_sip.c: Trying to put 'SIP/2.0 40' onto UDP socket destined for 192.168.1.133:5060
[Jun 25 12:08:54] VERBOSE[16182] asterisk.c:     -- Remote UNIX connection
[Jun 25 12:08:54] DEBUG[16207] chan_sip.c: Allocating new SIP dialog for 3eb9fdad4a5ce3c653f4a6ad31e4b557@127.0.1.1 - OPTIONS (No RTP)
[Jun 25 12:08:54] DEBUG[16207] acl.c: Found IP address for this socket
[Jun 25 12:08:54] DEBUG[16207] res_config_mysql.c: MySQL RealTime: Connection okay.
[Jun 25 12:08:54] DEBUG[16207] res_config_mysql.c: MySQL RealTime: Retrieve SQL: SELECT * FROM conf_sip WHERE name = '' AND host = 'dynamic'
[Jun 25 12:08:54] DEBUG[16207] res_config_mysql.c: MySQL RealTime: Could not find any rows in table conf_sip.

By: uros gaber (urosh) 2009-06-26 06:12:51

Hi. I changed to odbc, just like Imadsen suggested and now it works for one day. But I personally think that it still should be examined by developers.

By: Marcin Kowalczyk (kowalma) 2009-06-26 06:18:24

I also changed to ODBC and it works, but I'm going to start stress-test and start few thousand calls and regestrations...

By: uros gaber (urosh) 2009-06-26 06:25:24

Cool. Can you tell me please hot to do that ?

By: Marcin Kowalczyk (kowalma) 2009-06-26 06:29:55

sipp



By: Tilghman Lesher (tilghman) 2009-06-28 20:43:11

The problem initially reported in this issue should be fixed with the uploaded patch.  As to the lockup problem, I believe it is already fixed in SVN, though a new release of -addons has not yet been made with that change.  I suggest that you therefore try /asterisk-addons/branches/1.6.1/.

By: uros gaber (urosh) 2009-06-29 14:30:15

Thank you for response. I now cannot try suggested because I already moved to ODBC and I don't want to unstable asterisk again. Thank you for response again.

By: Leif Madsen (lmadsen) 2009-07-01 07:37:34

Could you try testing the patch on this issue to determine if it resolves the issue for you?

Thanks!

By: Marcin Kowalczyk (kowalma) 2009-07-01 07:48:51

I'm in middle of call stress-test for asterisk box. It will and after 5 milion calls will be made. For now I have bit over 3 milion. I think by tomorrow I will end stress-test then I will test solution.

By: Leif Madsen (lmadsen) 2009-07-01 08:16:16

Thanks for the feedback! Looking forward to hearing how it goes.

By: Marcin Kowalczyk (kowalma) 2009-07-02 04:52:05

I've patched system with provided patch.
I'll let you know results.

By: Marcin Kowalczyk (kowalma) 2009-07-03 08:13:41

Now connection is kept, but at some point database and asterisk connection drops.

Asterisk-node1*CLI> realtime mysql status
general connected to asterisk@127.0.0.1, port 3306 with username cdr for 0 seconds.
[Jul  3 15:12:16] ERROR[7654]: res_config_mysql.c:1467 mysql_reconnect: MySQL RealTime: Ping failed (2006).  Trying an explicit reconnect.
[Jul  3 15:12:16] ERROR[7654]: res_config_mysql.c:1467 mysql_reconnect: MySQL RealTime: Ping failed (2006).  Trying an explicit reconnect.
Asterisk-node1*CLI> realtime mysql status
general connected to asterisk@127.0.0.1, port 3306 with username cdr for 17 seconds.
Asterisk-node1*CLI> realtime mysql status
general connected to asterisk@127.0.0.1, port 3306 with username cdr for 18 seconds.
Asterisk-node1*CLI>

after I check status of realtime db is queried again

By: Jacco van Tuijl (jacco) 2009-07-03 09:34:02

I had the same isue; the patch fixed the isue.

I did not see the "Trying an explicit reconnect" messages

By: Marcin Kowalczyk (kowalma) 2009-07-03 09:40:46

Leave it running for 1-2 days.

By: Tilghman Lesher (tilghman) 2009-07-03 11:58:43

kowalma:  This is actually expected behavior, but it can be configured on the MySQL server side.  The issue is that idle connections are dropped.  The connection time reflects the amount of time that the connection is actually up, not the time that Asterisk is up (for that, see 'core show uptime').

By: Marcin Kowalczyk (kowalma) 2009-07-03 12:42:11

I would say this is issue as realtime for queue_log and sip peers should query database periodicly and idle should not occur. Or maybe I'm wrong?

By: Tilghman Lesher (tilghman) 2009-07-03 13:34:59

Neither query the database unless there are events on the PBX.  If you are idle overnight, for example, that could provide enough idle time for you to be disconnected from MySQL.

By: Jacco van Tuijl (jacco) 2009-07-06 04:08:12

I've been letting asterisk running idle for the weekend; now I did get the "Ping Failed" message


debian*CLI> realtime mysql status
general connected to asterisk@10.50.0.182, port 3306 with username test for 0 seconds.
[Jul  6 11:06:08] ERROR[6762]: res_config_mysql.c:1468 mysql_reconnect: MySQL RealTime: Ping failed (2006).  Trying an explicit reconnect.
debian*CLI> realtime mysql status
general connected to asterisk@10.50.0.182, port 3306 with username test for 6 seconds.
debian*CLI>

By: Digium Subversion (svnbot) 2009-07-06 16:30:14

Repository: asterisk-addons
Revision: 981

U   branches/1.4/res/res_config_mysql.c

------------------------------------------------------------------------
r981 | tilghman | 2009-07-06 16:30:13 -0500 (Mon, 06 Jul 2009) | 7 lines

Don't reset reconnect time, unless a reconnect really occurred.
(closes issue ASTERISK-14356)
Reported by: kowalma
Patches:
      20090628__issue15375.diff.txt uploaded by tilghman (license 14)
Tested by: kowalma, jacco

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk-addons?view=rev&revision=981

By: Digium Subversion (svnbot) 2009-07-06 16:31:41

Repository: asterisk-addons
Revision: 982

_U  trunk/

------------------------------------------------------------------------
r982 | tilghman | 2009-07-06 16:31:41 -0500 (Mon, 06 Jul 2009) | 14 lines

Recorded merge of revisions 981 via svnmerge from
https://origsvn.digium.com/svn/asterisk-addons/branches/1.4

........
 r981 | tilghman | 2009-07-06 16:30:13 -0500 (Mon, 06 Jul 2009) | 7 lines
 
 Don't reset reconnect time, unless a reconnect really occurred.
 (closes issue ASTERISK-14356)
  Reported by: kowalma
  Patches:
        20090628__issue15375.diff.txt uploaded by tilghman (license 14)
  Tested by: kowalma, jacco
........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk-addons?view=rev&revision=982

By: Digium Subversion (svnbot) 2009-07-06 16:32:53

Repository: asterisk-addons
Revision: 983

_U  branches/1.6.0/
U   branches/1.6.0/res/res_config_mysql.c

------------------------------------------------------------------------
r983 | tilghman | 2009-07-06 16:32:53 -0500 (Mon, 06 Jul 2009) | 21 lines

Merged revisions 982 via svnmerge from
https://origsvn.digium.com/svn/asterisk-addons/trunk

................
 r982 | tilghman | 2009-07-06 16:31:41 -0500 (Mon, 06 Jul 2009) | 14 lines
 
 Recorded merge of revisions 981 via svnmerge from
 https://origsvn.digium.com/svn/asterisk-addons/branches/1.4
 
 ........
   r981 | tilghman | 2009-07-06 16:30:13 -0500 (Mon, 06 Jul 2009) | 7 lines
   
   Don't reset reconnect time, unless a reconnect really occurred.
   (closes issue ASTERISK-14356)
    Reported by: kowalma
    Patches:
          20090628__issue15375.diff.txt uploaded by tilghman (license 14)
    Tested by: kowalma, jacco
 ........
................

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk-addons?view=rev&revision=983

By: Digium Subversion (svnbot) 2009-07-06 16:33:54

Repository: asterisk-addons
Revision: 984

_U  branches/1.6.1/
U   branches/1.6.1/res/res_config_mysql.c

------------------------------------------------------------------------
r984 | tilghman | 2009-07-06 16:33:54 -0500 (Mon, 06 Jul 2009) | 21 lines

Merged revisions 982 via svnmerge from
https://origsvn.digium.com/svn/asterisk-addons/trunk

................
 r982 | tilghman | 2009-07-06 16:31:41 -0500 (Mon, 06 Jul 2009) | 14 lines
 
 Recorded merge of revisions 981 via svnmerge from
 https://origsvn.digium.com/svn/asterisk-addons/branches/1.4
 
 ........
   r981 | tilghman | 2009-07-06 16:30:13 -0500 (Mon, 06 Jul 2009) | 7 lines
   
   Don't reset reconnect time, unless a reconnect really occurred.
   (closes issue ASTERISK-14356)
    Reported by: kowalma
    Patches:
          20090628__issue15375.diff.txt uploaded by tilghman (license 14)
    Tested by: kowalma, jacco
 ........
................

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk-addons?view=rev&revision=984

By: Digium Subversion (svnbot) 2009-07-06 16:34:58

Repository: asterisk-addons
Revision: 985

_U  branches/1.6.2/
U   branches/1.6.2/res/res_config_mysql.c

------------------------------------------------------------------------
r985 | tilghman | 2009-07-06 16:34:58 -0500 (Mon, 06 Jul 2009) | 21 lines

Merged revisions 982 via svnmerge from
https://origsvn.digium.com/svn/asterisk-addons/trunk

................
 r982 | tilghman | 2009-07-06 16:31:41 -0500 (Mon, 06 Jul 2009) | 14 lines
 
 Recorded merge of revisions 981 via svnmerge from
 https://origsvn.digium.com/svn/asterisk-addons/branches/1.4
 
 ........
   r981 | tilghman | 2009-07-06 16:30:13 -0500 (Mon, 06 Jul 2009) | 7 lines
   
   Don't reset reconnect time, unless a reconnect really occurred.
   (closes issue ASTERISK-14356)
    Reported by: kowalma
    Patches:
          20090628__issue15375.diff.txt uploaded by tilghman (license 14)
    Tested by: kowalma, jacco
 ........
................

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk-addons?view=rev&revision=985

By: Digium Subversion (svnbot) 2009-07-06 16:37:40

Repository: asterisk
Revision: 204986

U   trunk/addons/res_config_mysql.c

------------------------------------------------------------------------
r204986 | tilghman | 2009-07-06 16:37:40 -0500 (Mon, 06 Jul 2009) | 14 lines

Merged revisions 981 via svnmerge from
https://origsvn.digium.com/svn/asterisk-addons/branches/1.4

........
 r981 | tilghman | 2009-07-06 16:30:13 -0500 (Mon, 06 Jul 2009) | 7 lines
 
 Don't reset reconnect time, unless a reconnect really occurred.
 (closes issue ASTERISK-14356)
  Reported by: kowalma
  Patches:
        20090628__issue15375.diff.txt uploaded by tilghman (license 14)
  Tested by: kowalma, jacco
........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=204986