Summary:ASTERISK-04042: query loop and asterisk crash with realtime iax
Reporter:Joe Antkowiak (antkojm1)Labels:
Date Opened:2005-05-03 02:11:48Date Closed:2005-06-06 13:57:14
Versions:Frequency of
Environment:Attachments:( 0) bt.out
( 1) debug-2.txt
( 2) iax.conf
Description:whenever a user specified in the realtime db for iax registers, asterisk seems to go into a loop requerying the same record over and over until it crashes
Comments:By: Joe Antkowiak (antkojm1) 2005-05-03 02:17:43

ah yes, look at my db pw sitting in that debug...  argh.

By: John Robertson (katrat) 2005-05-03 13:29:15

I wanted to add to this that I am also experiencing this problem. Clean checkout of CVS-HEAD today:

Asterisk CVS-HEAD-05/03/05-10:57:27, Copyright (C) 1999 - 2005 Digium

Segfault only happens when loading iax friends (and users and peers ) from a database and rtcachefriends = yes. With rtcachefriends=no there is no crash.

debug log file has multiple consecutive entries (200+) of the following just prior to segfault:

May  3 14:05:54 DEBUG[9581] res_config_mysql.c: MySQL RealTime: Retrieve SQL: SELECT * FROM sip_buddies WHERE name = 'johnr'
May  3 14:05:54 DEBUG[9581] res_config_mysql.c: MySQL RealTime: Everything is fine.

I've also attached a backtrace of the corefile.

If there is any other info that would be of help in tracking down or recreating the problem please let me know.


By: Joe Antkowiak (antkojm1) 2005-05-03 16:24:45

I experience the issue even when rtcachefriends=no

By: Kevin P. Fleming (kpfleming) 2005-05-04 12:09:53

In the future, please try to categorize your issues correctly, so that we can reduce the incidence of duplicate reports.

By: Kevin P. Fleming (kpfleming) 2005-05-04 12:12:30

Can this problem be replicated using res_config_odbc? I'm curious to know whether it's res_config_mysql related, there have been changes there recently.

By: John Robertson (katrat) 2005-05-04 14:45:22

yes, it also happens when using res_config_odbc.

By: Anthony Minessale (anthm) 2005-05-04 14:56:53

can you add iax.conf too

By: John Robertson (katrat) 2005-05-04 15:03:20

The only thing missing from the iax.conf attached is a couple register lines for fwd and iaxtel, and i had those commented out anyway while trying to track down the cause of this issue.

Is there anything else that would be helpful?

By: Joe Antkowiak (antkojm1) 2005-05-04 15:06:16

I will have a box with this issue reproduced on up and running in about 2 hours.  If this would be at all helpful, please e-mail me - joe@jsci.net with your contact # so I can provide the root pw.

By: Anthony Minessale (anthm) 2005-05-04 15:18:49

des the sql st in your example:

SELECT * FROM users WHERE name = '4435246540'

produce a result from the cli of the db?

By: Anthony Minessale (anthm) 2005-05-04 15:21:34

if you are on irc msg me (anthm) with the answer

By: John Robertson (katrat) 2005-05-05 06:03:52

If I copy&paste the query listed in the DEBUG output into the MySQL CLI I get one row returned, the row I'd expect to see.

p.s. I hope I'm not confusing things here by jumping in along with the original reporter in responding to requests for info.

By: Anthony Minessale (anthm) 2005-05-05 09:29:07

I think it may be related to the new devicestate
Try this test

look for the line of code that looks like this:
(approx line 701)

.devicestate = iax2_devicestate,
and comment or cut it

see if you still get the problem and report the results.

By: John Robertson (katrat) 2005-05-05 11:09:48

I think you found it. Commented that out and recompiled chan_iax2 and can now register without segfaulting. From what limited testing I could do from my currently location things seem to work as they should; register with the server, see user in 'iax2 show users' and 'iax2 show peers', dial a couple extensions, etc.


By: Mark Spencer (markster) 2005-05-05 14:03:49

Can you find me on IRC so I can login and watch the bug happen while in real time on your box.  thanks.

By: Brian West (bkw918) 2005-05-15 14:52:21

cvs annotate channels/chan_iax2.c | grep iax2_devicestate

Annotations for channels/chan_iax2.c
1.254        (markster 04-Mar-05): static int iax2_devicestate(void *data);
1.254        (markster 04-Mar-05):      .devicestate = iax2_devicestate,
1.253        (markster 28-Feb-05): /*--- iax2_devicestate: Part of the device state notification system ---*/
1.253        (markster 28-Feb-05): static int iax2_devicestate(void *data)

By: Kevin P. Fleming (kpfleming) 2005-06-06 13:56:57

This has been fixed in CVS HEAD, at least for 'rtcachefriends=yes'. If there is still a problem with 'rtcachefriends=no', please open a new bug. Thanks!