From: "sr-users-request@lists.sip-router.org" <sr-users-request@lists.sip-router.org>
To: sr-users@lists.sip-router.org
Sent: Friday, February 17, 2012 7:34 AM
Subject: sr-users Digest, Vol 81, Issue 52
Send sr-users mailing list submissions to
sr-users@lists.sip-router.orgTo subscribe or unsubscribe via the World Wide Web, visit
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-usersor, via email, send a message with subject or body 'help' to
sr-users-request@lists.sip-router.orgYou can reach the person
managing the list at
sr-users-owner@lists.sip-router.orgWhen replying, please edit your Subject line so it is more specific
than "Re: Contents of sr-users digest..."
Today's Topics:
1. Re: ndb_redis module fails after a while
(Daniel-Constantin Mierla)
2. Re: Kamailio Exits With: Segmentation Fault Error 4 in
usrloc.so (Alexandr Dubovikov)
----------------------------------------------------------------------
Message: 1
Date: Fri, 17 Feb 2012 14:30:44 +0100
From: Daniel-Constantin Mierla <
miconda@gmail.com>
Subject: Re: [SR-Users] ndb_redis module fails after a while
To: "SIP Router - Kamailio (OpenSER) and SIP Express
Router (SER) -
Users Mailing List" <
sr-users@lists.sip-router.org>
Cc: Javier Gallart <
jgallartm@gmail.com>
Message-ID: <
4F3E5684.3090203@gmail.com>
Content-Type: text/plain; charset="iso-8859-1"; Format="flowed"
Hello,
right, very dummy paste position for resetting the redis context, use
the attached patch or exchange lines 228 and 229. in redis_client.c
Thanks,
Daniel
On 2/17/12 1:13 PM, Javier Gallart wrote:
> Hi Daniel, Andrew
>
> I've just tested the patch and kamailio crashes when the redis server
> is stopped. This is what I could get:
> -From the
logs:
> Feb 17 06:33:32 r-gate-test ./kamailio[23812]: ALERT: <core>
> [main.c:751]: child process 23819 exited by a signal 11
> Feb 17 06:33:32 r-gate-test ./kamailio[23812]: ALERT: <core>
> [main.c:754]: core was generated
> Feb 17 06:33:32 r-gate-test ./kamailio[23812]: INFO: <core>
> [main.c:766]: INFO: terminating due to SIGCHLD
>
> -An the backtrace:
> (...)
> Core was generated by `./kamailio -f ../etc/kamailio/kamailio.cfg'.
> Program terminated with signal 11, Segmentation fault.
> #0 redisFree (c=0x0) at hiredis.c:817
> 817 if (c->fd > 0)
> (gdb) bt
> #0 redisFree (c=0x0) at hiredis.c:817
> #1 0x00007f726f035461 in redisc_reconnect_server
> (rsrv=0x7f7271c93ac0) at redis_client.c:229
> #2 0x00007f726f037240 in redisc_exec (srv=<value optimized out>,
>
cmd=0x7fffe98c6090, argv1=<value optimized out>, argv2=<value
> optimized out>, argv3=<value optimized out>,
> res=<value optimized out>) at redis_client.c:298
> #3 0x00007f726f034f7d in w_redis_cmd3 (msg=0x7f7271d7b018,
> ssrv=<value optimized out>, scmd=<value optimized out>,
> sres=0x7f7271d74b58 "h\341\313qr\177") at ndb_redis_mod.c:156
> #4 0x0000000000417025 in do_action (h=0x7fffe98c6570,
> a=0x7f7271cc5248, msg=<value optimized out>) at action.c:1134
> #5 0x000000000041e58b in run_actions (h=<value optimized out>,
> a=<value optimized out>, msg=<value optimized out>) at action.c:1610
> #6 0x000000000041e8d4 in run_actions_safe (h=0x7fffe98c7610,
> a=0x7f7271c93781, msg=0x7f7271c93780) at action.c:1662
> #7 0x00000000004b731d in rval_get_int (h=0x7fffe98c7610,
msg=0x0,
> i=0x7fffe98c6bd8, rv=0x3, cache=0x4) at rvalue.c:920
> #8 0x00000000004bb87c in rval_expr_eval_int (h=0x7fffe98c7610,
> msg=0x7f7271d7b018, res=0x7fffe98c6bd8, rve=0x7f7271cc6768) at
> rvalue.c:1914
> #9 0x0000000000417c7c in do_action (h=0x7fffe98c7610,
> a=0x7f7271ccb9d0, msg=<value optimized out>) at action.c:1092
> #10 0x000000000041e58b in run_actions (h=<value optimized out>,
> a=<value optimized out>, msg=<value optimized out>) at action.c:1610
> #11 0x0000000000417cd7 in do_action (h=0x7fffe98c7610,
> a=0x7f7271ccbb10, msg=<value optimized out>) at action.c:1111
> #12 0x000000000041e58b in run_actions (h=<value optimized out>,
> a=<value optimized out>, msg=<value optimized out>) at action.c:1610
> #13 0x000000000041795e in do_action (h=0x7fffe98c7610, a=<value
> optimized out>,
msg=<value optimized out>) at action.c:732
> #14 0x000000000041e58b in run_actions (h=<value optimized out>,
> a=<value optimized out>, msg=<value optimized out>) at action.c:1610
> #15 0x000000000041e862 in run_top_route (a=0x7f7271c94888,
> msg=0x7f7271d7b018, c=<value optimized out>) at action.c:1683
> #16 0x0000000000498f36 in receive_msg (
> buf=0x8bb100 "INVITE sip:34661574758@79.170.68.215:5060
> <
http://sip:34661574758@79.170.68.215:5060> SIP/2.0\r\nVia:
> SIP/2.0/UDP 79.170.68.214:5060;branch=z9hG4bK-9451-1-0\r\nFrom:
> 34661574758 <sip:34661574758@79.170.68.214:5060
> <
http://sip:34661574758@79.170.68.214:5060>>;tag=9451SIPpTag001\r\nTo:
> sut <sip:"...,
len=<value optimized out>, rcv_info=0x7fffe98c7910) at
> receive.c:207
> #17 0x0000000000525987 in udp_rcv_loop () at udp_server.c:544
> #18 0x00000000004635f4 in main_loop () at main.c:1585
> #19 0x0000000000465e62 in main (argc=3, argv=0x7fffe98c7c08) at
> main.c:2475
>
>
> Regards
>
> Javi
>
> On Fri, Feb 17, 2012 at 11:39 AM, Daniel-Constantin Mierla
> <
miconda@gmail.com <mailto:
miconda@gmail.com>> wrote:
>
> Hello,
>
> thanks for testing, indeed it was an extra declaration left over.
> Can you try with the new patch attached?
>
> Cheers,
> Daniel
>
>
> On
2/17/12 11:10 AM, Andrew Pogrebennyk wrote:
>
> Hi Daniel,
>
> On 02/17/2012 10:47 AM, Daniel-Constantin Mierla wrote:
>
> I made a patch for server reconnect -- I had no access to
> a computer
> with redis lib installed for the moment, hopefully it
> compiles. If you
> can try and tell the result, it would be great, I can
> commit then.
>
> I may be able to test this patch as well. Currently
> compilations bails
> out on attempt to redeclare redisc_reconnect_server
function
> parameter:
>
> CC (gcc) [M ndb_redis.so] ndb_redis_mod.o
> CC (gcc) [M ndb_redis.so] redis_client.o
> redis_client.c: In function 'redisc_reconnect_server':
> redis_client.c:206:19: error: 'rsrv' redeclared as different
> kind of symbol
> redis_client.c:202:46: note: previous definition of 'rsrv' was
> here
> make[1]: *** [redis_client.o] Error 1
> make: *** [modules] Error 1
>
> _______________________________________________
> SIP
Express Router (SER) and Kamailio (OpenSER) - sr-users
> mailing list
>
sr-users@lists.sip-router.org> <mailto:
sr-users@lists.sip-router.org>
>
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users>
>
> --
> Daniel-Constantin Mierla --
http://www.asipto.com>
http://linkedin.com/in/miconda --
http://twitter.com/miconda>
>
>
>
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
>
sr-users@lists.sip-router.org>
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users--
Daniel-Constantin Mierla --
http://www.asipto.comhttp://linkedin.com/in/miconda --
http://twitter.com/miconda-------------- next part --------------
An HTML attachment was scrubbed...
URL: <
http://lists.sip-router.org/pipermail/sr-users/attachments/20120217/1d77887f/attachment-0001.htm>
-------------- next part --------------
diff --git a/modules/ndb_redis/redis_client.c b/modules/ndb_redis/redis_client.c
index 9f4ffc4..234bb3a 100644
--- a/modules/ndb_redis/redis_client.c
+++ b/modules/ndb_redis/redis_client.c
@@ -199,6 +199,61 @@ redisc_server_t *redisc_get_server(str *name)
/**
*
*/
+int redisc_reconnect_server(redisc_server_t *rsrv)
+{
+ char *addr;
+ unsigned int port, db;
+ param_t *pit = NULL;
+ struct timeval tv;
+
+ tv.tv_sec = 1;
+ tv.tv_usec = 0;
+ addr = "127.0.0.1";
+ port =
6379;
+ db = 0;
+ for (pit = rsrv->attrs; pit; pit=pit->next)
+ {
+ if(pit->name.len==4 && strncmp(pit->name.s, "addr", 4)==0) {
+ addr = pit->body.s;
+ addr[pit->body.len] = '\0';
+ } else if(pit->name.len==4 && strncmp(pit->name.s, "port", 4)==0) {
+ if(str2int(&pit->body, &port) < 0)
+ port = 6379;
+ } else if(pit->name.len==2 && strncmp(pit->name.s, "db", 2)==0) {
+ if(str2int(&pit->body,
&db) < 0)
+ db = 0;
+ }
+ }
+ if(rsrv->ctxRedis!=NULL) {
+ redisFree(rsrv->ctxRedis);
+ rsrv->ctxRedis = NULL;
+ }
+
+ rsrv->ctxRedis = redisConnectWithTimeout(addr, port, tv);
+ if(!rsrv->ctxRedis)
+ goto err;
+ if (rsrv->ctxRedis->err)
+ goto err2;
+ if (redisCommandNR(rsrv->ctxRedis, "PING"))
+ goto err2;
+ if (redisCommandNR(rsrv->ctxRedis, "SELECT %i", db))
+ goto
err2;
+
+ return 0;
+
+err2:
+ LM_ERR("error communicating with redis server [%.*s] (%s:%d/%d): %s\n",
+ rsrv->sname->len, rsrv->sname->s, addr, port, db, rsrv->ctxRedis->errstr);
+ return -1;
+err:
+ LM_ERR("failed to connect to redis server [%.*s] (%s:%d/%d)\n",
+ rsrv->sname->len, rsrv->sname->s, addr, port, db);
+ return -1;
+}
+
+/**
+ *
+ */
int redisc_exec(str *srv, str *cmd, str *argv1, str *argv2, str *argv3,
str *res)
{
@@ -237,6 +292,14 @@ int redisc_exec(str *srv, str *cmd, str *argv1, str *argv2, str *argv3,
c = cmd->s[cmd->len];
cmd->s[cmd->len] = '\0';
rpl->rplRedis
= redisCommand(rsrv->ctxRedis, cmd->s);
+ if(rpl->rplRedis == NULL)
+ {
+ /* null reply, reconnect and try again */
+ if(redisc_reconnect_server(rsrv)==0)
+ {
+ rpl->rplRedis = redisCommand(rsrv->ctxRedis, cmd->s);
+ }
+ }
cmd->s[cmd->len] = c;
return 0;
}
------------------------------
Message: 2
Date: Fri, 17 Feb 2012 14:34:18 +0100
From: Alexandr Dubovikov <
voip@start4.info>
Subject: Re: [SR-Users] Kamailio Exits With: Segmentation Fault Error
4 in usrloc.so
To:
miconda@gmail.comCc: "SIP Router - Kamailio \(OpenSER\) and SIP Express Router \(SER\)
- Users Mailing List" <
sr-users@lists.sip-router.org>
Message-ID: <
4F3E575A.8070909@start4.info>
Content-Type: text/plain; charset="iso-8859-1"; Format="flowed"
Hi Daniel,
ok, I will fix it in the sipcapture on this WE.
Wbr,
Alexandr
17.02.2012 14:26, Daniel-Constantin Mierla wrote:
> Hello,
>
> On 2/17/12 2:09 PM, Alexandr Dubovikov wrote:
>>
>> Hi,
>>
>> If i got it also correct:
>>
>> Simpson is getting SIP messages from a raw socket in the
sipcapture
>> module and try to save all REGISTER messages to the location table
>> through the userloc module. (user registration audit)
>
> so sipcapture is executing the request route block from the config
> even for packages received on the raw sockets. In this case it does
> not set the socket and its string representation...
>
> Not sure yet the best place where it should be fixed: in usrloc (to
> test for sock and sock_str) or in sipcapture, to set this fields as
> most of the other config function. The second will be safer overall,
> but might not be an usable socket for sending (if someone will attempt
> to do lookup location and relay).
>
> Cheers,
> Daniel
>
>
>>
>> Wbr,
>> Alexandr
>>
>> 17.02.2012 13:49, Daniel-Constantin Mierla wrote:
>>>
Hello,
>>>
>>> On 2/17/12 1:11 PM, Alexandr Dubovikov wrote:
>>>> Hi Daniel,
>>>>
>>>> he use raw_socket in the sipcapture module and save all REGISTER
>>>> messages to location. (something like fraud controling for
>>>> registration). I think in this case he have to ignore socket listener.
>>>
>>> not sure I understood -- it is on the server that saves to homer's
>>> database? It gets the traffic over a raw socket and then executes
>>> the config file as usual with functions from other modules?
>>>
>>> Cheers,
>>> Daniel
>>>
>>>>
>>>> Wbr,
>>>> Alexandr
>>>>
>>>>
>>>>
>>>>
>>>> 17.02.2012 09:19, Daniel-Constantin Mierla
wrote:
>>>>> Hello,
>>>>>
>>>>> looks like an invalid listen socket structure, quite strange...
>>>>> what version of kamailio do you have?
>>>>>
>>>>> Also, in gdb, frame 0, can you send the output of:
>>>>>
>>>>> p *_c
>>>>> p *_c->sock
>>>>>
>>>>> You can replace sensitive data (like IP), if you wish.
>>>>>
>>>>> Cheers,
>>>>> Daniel
>>>>>
>>>>> On 2/16/12 10:52 PM, Simpson Chua wrote:
>>>>>> Hi,
>>>>>>
>>>>>> Kamailio is exiting with a segmentation fault when trying to do a
>>>>>> save("location"). Here is some information I
gathered.
>>>>>>
>>>>>> Feb 16 15:30:19 ubuntu /usr/local/sbin/kamailio[25721]: DEBUG:
>>>>>> <core> [parser/msg_parser.c:103]: found end of header
>>>>>> Feb 16 15:30:19 ubuntu /usr/local/sbin/kamailio[25721]: ERROR:
>>>>>> <core> [db.c:435]: invalid parameter value
>>>>>> Feb 16 15:30:19 ubuntu /usr/local/sbin/kamailio[25721]: ERROR:
>>>>>> usrloc [udomain.c:564]: failed to use table location
>>>>>> Feb 16 15:30:19 ubuntu kernel: [171540.056663] kamailio[25721]:
>>>>>> segfault at 89 ip 00007fa1f9a41452 sp 00007fff971a3af0 error 4 in
>>>>>> usrloc.so[7fa1f9a37000+1f000]
>>>>>> Feb 16 15:30:19 ubuntu /usr/local/sbin/kamailio[25708]: ALERT:
>>>>>> <core> [main.c:751]: child process
25720 exited by a signal 11
>>>>>> Feb 16 15:30:19 ubuntu /usr/local/sbin/kamailio[25708]: ALERT:
>>>>>> <core> [main.c:754]: core was generated
>>>>>> Feb 16 15:30:19 ubuntu /usr/local/sbin/kamailio[25708]: INFO:
>>>>>> <core> [main.c:766]: INFO: terminating due to SIGCHLD
>>>>>>
>>>>>> Core was generated by `kamailio -w /home/core'.
>>>>>> Program terminated with signal 11, Segmentation fault.
>>>>>> #0 db_insert_ucontact (_c=0x7f5f8f737eb0) at ucontact.c:474
>>>>>> 474 vals[11].val.str_val = _c->sock->sock_str;
>>>>>> (gdb) bt
>>>>>> #0 db_insert_ucontact (_c=0x7f5f8f737eb0) at ucontact.c:474
>>>>>>
#1 0x00007f5f916d9649 in insert_ucontact (_r=<optimized out>,
>>>>>> _contact=<optimized out>, _ci=<optimized out>, _c=0x7fff52bbeb88)
>>>>>> at urecord.c:473
>>>>>> #2 0x00007f5f914b785f in insert_contacts (_m=0x7f5f93d7f458,
>>>>>> _d=0x7f5f8f72f680, _a=0x7fff52bbec00) at save.c:428
>>>>>> #3 0x00007f5f914b8d10 in add_contacts (_mode=1,
>>>>>> _a=0x7fff52bbec00, _d=0x7f5f8f72f680, _m=0x7f5f93d7f458) at
>>>>>> save.c:737
>>>>>> #4 save (_m=0x7f5f93d7f458, _d=0x7f5f8f72f680, _cflags=4) at
>>>>>> save.c:790
>>>>>> #5 0x000000000041ba87 in do_action (h=0x7fff52bbf5d0,
>>>>>> a=0x7f5f93d7f238, msg=0x7f5f93d7f458) at action.c:1128
>>>>>> #6
0x000000000041abe2 in run_actions (h=0x7fff52bbf5d0,
>>>>>> a=0x7f5f93d7f238, msg=0x7f5f93d7f458) at action.c:1610
>>>>>> #7 0x000000000041c05b in do_action (h=0x7fff52bbf5d0,
>>>>>> a=0x7f5f93d7fe08, msg=0x7f5f93d7f458) at action.c:1107
>>>>>> #8 0x000000000041abe2 in run_actions (h=0x7fff52bbf5d0,
>>>>>> a=0x7f5f93d7fe08, msg=0x7f5f93d7f458) at action.c:1610
>>>>>> #9 0x0000000000422fa2 in run_top_route (a=0x7f5f93d7fe08,
>>>>>> msg=0x7f5f93d7f458, c=<optimized out>) at action.c:1683
>>>>>> #10 0x00000000004b061e in receive_msg (buf=<optimized out>,
>>>>>> len=<optimized out>, rcv_info=<optimized out>) at receive.c:207
>>>>>> #11 0x00007f5f91b038b0 in raw_capture_rcv_loop (rsock=5,
>>>>>> port1=5060, port2=8933, ipip=0) at sipcapture.c:1518
>>>>>> #12 0x00007f5f91b03e1f in init_rawsock_children () at
>>>>>> sipcapture.c:572
>>>>>> #13 0x00007f5f91b04033 in child_init (rank=<optimized out>) at
>>>>>> sipcapture.c:542
>>>>>> #14 0x0000000000507a0f in init_mod_child (m=0x7f5f93d7b2b0,
>>>>>> rank=0) at sr_module.c:886
>>>>>> #15 0x0000000000507974 in init_mod_child (m=0x7f5f93d7b668,
>>>>>> rank=0) at sr_module.c:883
>>>>>> #16 0x0000000000507974 in init_mod_child (m=0x7f5f93d7c178,
>>>>>> rank=0) at sr_module.c:883
>>>>>> #17 0x0000000000507974 in init_mod_child (m=0x7f5f93d7c4b0,
>>>>>> rank=0) at sr_module.c:883
>>>>>> #18
0x0000000000476149 in main_loop () at main.c:1661
>>>>>> #19 0x000000000041a940 in main (argc=<optimized out>,
>>>>>> argv=0x7fff52bbfd68) at main.c:2475
>>>>>>
>>>>>> Any idea why this is happening? Is there something in the
>>>>>> REGISTER message that is causing this?
>>>>>>
>>>>>> Thanks,
>>>>>> Simpson
>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
>>>>>>
sr-users@lists.sip-router.org>>>>>>
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users>>>>>
>>>>> --
>>>>> Daniel-Constantin Mierla --
http://www.asipto.com>>>>>
http://linkedin.com/in/miconda --
http://twitter.com/miconda>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
>>>>>
sr-users@lists.sip-router.org>>>>>
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users>>>>
>>>
>>> --
>>> Daniel-Constantin Mierla --
http://www.asipto.com>>>
http://linkedin.com/in/miconda --
http://twitter.com/miconda>>
>>
>>
>> _______________________________________________
>> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
>>
sr-users@lists.sip-router.org>>
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users>>
>> --
>> Daniel-Constantin Mierla --
http://www.asipto.com>>
http://linkedin.com/in/miconda --
http://twitter.com/miconda-------------- next part --------------
An HTML attachment was scrubbed...
URL: <
http://lists.sip-router.org/pipermail/sr-users/attachments/20120217/931efb00/attachment.htm>
------------------------------
_______________________________________________
sr-users mailing list
sr-users@lists.sip-router.orghttp://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-usersEnd of sr-users Digest, Vol 81, Issue 52
****************************************