[SR-Users] drouting module: can I use non-digit prefix?

Daniel-Constantin Mierla miconda at gmail.com
Thu Jun 14 13:01:29 CEST 2012


Hello,

On 6/14/12 11:36 AM, Yufei Tao wrote:
> Hi Daniel
>
> I've tried the patch on my 3.2.2 and it doesn't crash now!
thanks for feedback -- I backported the patch to 3.3 and 3.2 branches.

Cheers,
Daniel

>
> Thanks!
> Yufei
>
> On 13/06/12 10:55, Daniel-Constantin Mierla wrote:
>> Hello,
>>
>> can you try with the patch from commit:
>>
>> http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=c737ff95bb2e742981d81088169baa60d4605b85
>>
>>
>> It is one line of effective code that you have to change. Let me know
>> if goes ok now and I will backport to stable branches.
>>
>> Cheers,
>> Daniel
>>
>> On 6/13/12 11:16 AM, Yufei Tao wrote:
>>> Hi Daniel
>>>
>>> The version is:
>>>
>>> version: kamailio 3.2.2 (i386/linux)
>>> flags: STATS: Off, USE_IPV6, USE_TCP, USE_TLS, TLS_HOOKS, USE_RAW_SOCKS,
>>> DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MEM, SHM_MMAP, PKG_MALLOC,
>>> DBG_QM_MALLOC, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE,
>>> USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLACKLIST, HAVE_RESOLV_RES
>>> ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN 16,
>>> MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 4MB
>>> poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
>>> id: unknown
>>> compiled on 14:19:11 Mar 1 2012 with gcc 4.4.3
>>>
>>>
>>> 2 core dump files were created from the same crash (when using MI
>>> command dr_reload to load the dr_rules talbe with non-digit prefix) and
>>> the following are results for each of them with "bt full" under gdb:
>>>
>>> ========================================================================
>>> 1. sudo gdb /usr/sbin/kamailio /tmp/corefiles/core.kamailio.sig6.6130
>>>
>>> Core was generated by `/usr/sbin/kamailio -f /etc/kamailio/kamailio.cfg
>>> -P /var/run/kamailio/kamailio.'.
>>> Program terminated with signal 6, Aborted.
>>> (gdb) bt full
>>> #0 0x00780422 in __kernel_vsyscall ()
>>> No symbol table info available.
>>> #1 0x0013a651 in raise () from /lib/tls/i686/cmov/libc.so.6
>>> No symbol table info available.
>>> #2 0x0013da82 in abort () from /lib/tls/i686/cmov/libc.so.6
>>> No symbol table info available.
>>> #3 0x081779e2 in qm_free (qm=0xa730a000, p=0xa77b4814,
>>> file=0x74c751 "drouting: prefix_tree.c", func=0x74c81d "del_tree",
>>> line=270)
>>> at mem/q_malloc.c:458
>>> f = 0xa77b47fc
>>> size = <value optimised out>
>>> #4 0x0074477f in del_tree (t=0xa77b4814) at prefix_tree.c:270
>>> j = <value optimised out>
>>> __FUNCTION__ = "del_tree"
>>> #5 0x0074608c in free_rt_data (rt_data=0xa778f2e8, all=1) at
>>> routing.c:451
>>> j = <value optimised out>
>>> __FUNCTION__ = "free_rt_data"
>>> #6 0x0073b025 in dr_exit () at drouting.c:450
>>> __FUNCTION__ = "dr_exit"
>>> #7 0x0812354c in destroy_modules () at sr_module.c:783
>>> t = <value optimised out>
>>> foo = 0xb734cd54
>>> __FUNCTION__ = "destroy_modules"
>>> #8 0x080a3ebc in cleanup (show_status=1) at main.c:536
>>> memlog = <value optimised out>
>>> __FUNCTION__ = "cleanup"
>>> #9 0x080a4c28 in shutdown_children (show_status=1, sig=<value optimised
>>> out>) at main.c:678
>>> No locals.
>>> #10 0x080a5d24 in handle_sigs () at main.c:769
>>> chld = 0
>>> chld_status = 134
>>> memlog = <value optimised out>
>>> #11 0x080a70e8 in main_loop () at main.c:1713
>>> i = 16
>>> pid = <value optimised out>
>>> si = 0x0
>>> si_desc = "udp receiver child=15
>>> sock=82.219.14.194:5060\000\067\267\003\000\000\000\357\002{\000`\376
>>> \023\001\001\000\000\000\000\000\000\000\002\000\000\000\357 \002{\000
>>> \230#$\b\002\000\000\000\070[+\b\v\212濘y\346\277\000\210q
>>> \246\360\370;\267\004\000\000\000\031%\037\b\001\000\000\000`[+\b\v \212
>>> 濸y", <incomplete sequence \346\277>
>>> #12 0x080a8ae7 in main (argc=13, argv=0xbfe67b04) at main.c:2475
>>> cfg_stream = 0x93a1008
>>> c = <value optimised out>
>>> r = 0
>>> tmp = 0xbfe68a30 ""
>>> tmp_len = 136192016
>>> port = <value optimised out>
>>> proto = <value optimised out>
>>> ret = <value optimised out>
>>> seed = 2291282674
>>> rfd = 0
>>> debug_save = -1075410421
>>> debug_flag = 276824064
>>> n_lst = 0xbfe68a0b
>>>
>>> ========================================================================
>>> 2. sudo gdb /usr/sbin/kamailio /tmp/corefiles/core.kamailio.sig6.6155
>>>
>>> Core was generated by `/usr/sbin/kamailio -f /etc/kamailio/kamailio.cfg
>>> -P /var/run/kamailio/kamailio.'.
>>> Program terminated with signal 6, Aborted.
>>> #0 0x00780422 in __kernel_vsyscall ()
>>> (gdb) bt full
>>> #0 0x00780422 in __kernel_vsyscall ()
>>> No symbol table info available.
>>> #1 0x0013a651 in raise () from /lib/tls/i686/cmov/libc.so.6
>>> No symbol table info available.
>>> #2 0x0013da82 in abort () from /lib/tls/i686/cmov/libc.so.6
>>> No symbol table info available.
>>> #3 0x081779e2 in qm_free (qm=0xa730a000, p=0x4, file=0x74c751 "drouting:
>>> prefix_tree.c",
>>> func=0x74c81d "del_tree", line=264) at mem/q_malloc.c:458
>>> f = 0x74dff4
>>> size = <value optimised out>
>>> #4 0x00744706 in del_tree (t=0xa778f130) at prefix_tree.c:264
>>> j = <value optimised out>
>>> __FUNCTION__ = "del_tree"
>>> #5 0x0074608c in free_rt_data (rt_data=0xa778f0e4, all=1) at
>>> routing.c:451
>>> j = <value optimised out>
>>> __FUNCTION__ = "free_rt_data"
>>> #6 0x0073b6d2 in dr_reload_data (cmd_tree=0x0, param=0x0) at
>>> drouting.c:261
>>> new_data = <value optimised out>
>>> old_data = 0x6
>>> #7 dr_reload_cmd (cmd_tree=0x0, param=0x0) at drouting.c:487
>>> No locals.
>>> #8 0x00edc7a2 in run_mi_cmd (fifo_stream=0x93ee330) at
>>> ../../lib/kmi/mi.h:77
>>> No locals.
>>> #9 mi_fifo_server (fifo_stream=0x93ee330) at fifo_fnc.c:509
>>> mi_cmd = 0x0
>>> mi_rpl = <value optimised out>
>>> hdl = 0x0
>>> line_len = 1
>>> command = 0xb73eb1ed ""
>>> file = <value optimised out>
>>> f = 0x93d1f44
>>> reply_stream = 0x93f5100
>>> #10 0x00ede820 in fifo_process (rank=1) at mi_fifo.c:247
>>> fifo_stream = 0x93ee330
>>> #11 0x00edeb88 in mi_child_init (rank=0) at mi_fifo.c:211
>>> pid = <value optimised out>
>>> #12 0x0812294f in init_mod_child (m=0xb734572c, rank=0) at
>>> sr_module.c:886
>>> No locals.
>>> #13 0x081228c0 in init_mod_child (m=0xb73458a8, rank=0) at
>>> sr_module.c:883
>>> No locals.
>>> #14 0x081228c0 in init_mod_child (m=0xb7345d2c, rank=0) at
>>> sr_module.c:883
>>> No locals.
>>> #15 0x081228c0 in init_mod_child (m=0xb7346b1c, rank=0) at
>>> sr_module.c:883
>>> No locals.
>>> #16 0x081228c0 in init_mod_child (m=0xb7347068, rank=0) at
>>> sr_module.c:883
>>> No locals.
>>> #17 0x081228c0 in init_mod_child (m=0xb7347304, rank=0) at
>>> sr_module.c:883
>>> No locals.
>>> #18 0x081228c0 in init_mod_child (m=0xb7347718, rank=0) at
>>> sr_module.c:883
>>> No locals.
>>> #19 0x081228c0 in init_mod_child (m=0xb734a204, rank=0) at
>>> sr_module.c:883
>>> No locals.
>>> #20 0x081228c0 in init_mod_child (m=0xb734a434, rank=0) at
>>> sr_module.c:883
>>> No locals.
>>> #21 0x081228c0 in init_mod_child (m=0xb734a628, rank=0) at
>>> sr_module.c:883
>>> No locals.
>>> #22 0x081228c0 in init_mod_child (m=0xb734a9b8, rank=0) at
>>> sr_module.c:883
>>> No locals.
>>> #23 0x081228c0 in init_mod_child (m=0xb734b02c, rank=0) at
>>> sr_module.c:883
>>> No locals.
>>> #24 0x081228c0 in init_mod_child (m=0xb734b4dc, rank=0) at
>>> sr_module.c:883
>>> No locals.
>>> #25 0x081228c0 in init_mod_child (m=0xb734b828, rank=0) at
>>> sr_module.c:883
>>> No locals.
>>> #26 0x081228c0 in init_mod_child (m=0xb734ba20, rank=0) at
>>> sr_module.c:883
>>> No locals.
>>> #27 0x081228c0 in init_mod_child (m=0xb734bde8, rank=0) at
>>> sr_module.c:883
>>> No locals.
>>> #28 0x081228c0 in init_mod_child (m=0xb734c100, rank=0) at
>>> sr_module.c:883
>>> No locals.
>>> #29 0x081228c0 in init_mod_child (m=0xb734c330, rank=0) at
>>> sr_module.c:883
>>> No locals.
>>> #30 0x081228c0 in init_mod_child (m=0xb734c9ac, rank=0) at
>>> sr_module.c:883
>>> No locals.
>>> #31 0x081228c0 in init_mod_child (m=0xb734cd54, rank=0) at
>>> sr_module.c:883
>>> No locals.
>>> #32 0x081228c0 in init_mod_child (m=0xb734d06c, rank=0) at
>>> sr_module.c:883
>>> No locals.
>>> #33 0x081228c0 in init_mod_child (m=0xb734d360, rank=0) at
>>> sr_module.c:883
>>> No locals.
>>> #34 0x081228c0 in init_mod_child (m=0xb734d7e8, rank=0) at
>>> sr_module.c:883
>>> No locals.
>>> #35 0x081228c0 in init_mod_child (m=0xb734da60, rank=0) at
>>> sr_module.c:883
>>> No locals.
>>> #36 0x081228c0 in init_mod_child (m=0xb734dcd4, rank=0) at
>>> sr_module.c:883
>>> No locals.
>>> #37 0x081228c0 in init_mod_child (m=0xb734e028, rank=0) at
>>> sr_module.c:883
>>> No locals.
>>> #38 0x081228c0 in init_mod_child (m=0xb734e21c, rank=0) at
>>> sr_module.c:883
>>> No locals.
>>> #39 0x081228c0 in init_mod_child (m=0xb734e650, rank=0) at
>>> sr_module.c:883
>>> No locals.
>>> #40 0x081228c0 in init_mod_child (m=0xb734e828, rank=0) at
>>> sr_module.c:883
>>> No locals.
>>> #41 0x081228c0 in init_mod_child (m=0xb734e9fc, rank=0) at
>>> sr_module.c:883
>>> No locals.
>>> #42 0x081228c0 in init_mod_child (m=0xb734fde8, rank=0) at
>>> sr_module.c:883
>>> No locals.
>>> #43 0x081228c0 in init_mod_child (m=0xb7350260, rank=0) at
>>> sr_module.c:883
>>> No locals.
>>> #44 0x080a6fcd in main_loop () at main.c:1661
>>> i = 16
>>> pid = 0
>>> si = 0x0
>>> si_desc = "udp receiver child=15
>>> sock=82.219.14.194:5060\000\067\267\003\000\000\000\357\002{\000`\376
>>> \023\001\001\000\000\000\000\000\000\000\002\000\000\000\357 \002{\000
>>> \230#$\b\002\000\000\000\070[+\b\v\212濘y\346\277\000\210q
>>> \246\360\370;\267\004\000\000\000\031%\037\b\001\000\000\000`[+\b\v \212
>>> 濸y", <incomplete sequence \346\277>
>>> #45 0x080a8ae7 in main (argc=13, argv=0xbfe67b04) at main.c:2475
>>> cfg_stream = 0x93a1008
>>> c = <value optimised out>
>>> r = 0
>>> tmp = 0xbfe68a30 ""
>>> tmp_len = 136192016
>>> port = <value optimised out>
>>> proto = <value optimised out>
>>> ret = <value optimised out>
>>> seed = 2291282674
>>> rfd = 0
>>> debug_save = -1075410421
>>> debug_flag = 276824064
>>> n_lst = 0xbfe68a0b
>>>
>>>
>>>
>>> Thanks!
>>> Yufei
>>>
>>> On 13/06/12 09:15, Daniel-Constantin Mierla wrote:
>>>> Hello,
>>>>
>>>> this situation seems to be caused by the fact there is no valid
>>>> routing rule at all.
>>>>
>>>> Can you get the backtrace? First do:
>>>>
>>>> ulimit -c unlimited
>>>>
>>>> Then run again an a corefile should be generated (in / or in working
>>>> directory) - use gdb to get the backtrace:
>>>>
>>>> gdb /path/to/kamailio /path/to/corefile
>>>>
>>>> bt full
>>>>
>>>> Send the output here.
>>>>
>>>> Also send 'kamailio -V' to know exactly your version.
>>>>
>>>> Cheers,
>>>> Daniel
>>>>
>>>>
>>>> On 6/12/12 4:33 PM, Yufei Tao wrote:
>>>>> Hi Daniel
>>>>>
>>>>> Thanks for the reply!
>>>>>
>>>>> I tried it again and the log seems to suggest it crashed when loading
>>>>> the dr_rules table that contains non-digit prefix, e.g. prefix bing
>>>>> 'abc.':
>>>>>
>>>>> 1. First crash when doing MI command "dr_reload":
>>>>> "
>>>>> Jun 12 15:19:07 myserver2 /usr/sbin/kamailio[2293]: INFO: drouting
>>>>> [drouting.c:476]: "dr_reload" MI command received!
>>>>> Jun 12 15:19:08 myserver2 /usr/sbin/kamailio[2293]: ERROR: drouting
>>>>> [dr_load.c:251]: failed to add prefix route
>>>>> Jun 12 15:19:08 myserver2 /usr/sbin/kamailio[2293]: ERROR: drouting
>>>>> [dr_load.c:555]: failed to add rule id 1 -> skipping
>>>>> Jun 12 15:19:08 myserver2 /usr/sbin/kamailio[2293]: WARNING: drouting
>>>>> [dr_load.c:577]: no valid routing rules -> discarding all destinations
>>>>> Jun 12 15:19:08 myserver2 /usr/sbin/kamailio[2357]: : <core>
>>>>> [pass_fd.c:293]: ERROR: receive_fd: EOF on 30
>>>>> Jun 12 15:19:08 myserver2 /usr/sbin/kamailio[2274]: ALERT: <core>
>>>>> [main.c:751]: child process 2293 exited by a signal 11
>>>>> Jun 12 15:19:08 myserver2 /usr/sbin/kamailio[2274]: ALERT: <core>
>>>>> [main.c:754]: core was not generated
>>>>> Jun 12 15:19:08 myserver2 /usr/sbin/kamailio[2274]: INFO: <core>
>>>>> [main.c:766]: INFO: terminating due to SIGCHLD
>>>>> Jun 12 15:19:08 myserver2 /usr/sbin/kamailio[2357]: INFO: <core>
>>>>> [main.c:817]: INFO: signal 15 received
>>>>> Jun 12 15:19:08 myserver2 /usr/sbin/kamailio[2356]: INFO: <core>
>>>>> [main.c:817]: INFO: signal 15 received
>>>>> ... ...
>>>>> "
>>>>>
>>>>> 2. And the second crash on start up (with the bad dr_rules prefix):
>>>>>
>>>>> "
>>>>> Jun 12 15:20:16 myserver2 /usr/sbin/kamailio[5352]: WARNING: drouting
>>>>> [dr_load.c:577]: no valid routing rules -> discarding all destinations
>>>>> Jun 12 15:20:16 myserver2 /usr/sbin/kamailio[5352]: : <core>
>>>>> [mem/q_malloc.c:440]: BUG: qm_free: bad pointer 0x4 (out of memory
>>>>> block!) - aborting
>>>>> Jun 12 15:20:16 myserver2 /usr/sbin/kamailio[5393]: : <core>
>>>>> [pass_fd.c:293]: ERROR: receive_fd: EOF on 30
>>>>> Jun 12 15:20:16 myserver2 /usr/sbin/kamailio[5333]: ALERT: <core>
>>>>> [main.c:751]: child process 5352 exited by a signal 6
>>>>> Jun 12 15:20:16 myserver2 /usr/sbin/kamailio[5393]: DEBUG: <core>
>>>>> [tcp_main.c:3555]: DBG: handle_ser_child: dead child 19, pid 5352
>>>>> (shutting down?)
>>>>> Jun 12 15:20:16 myserver2 /usr/sbin/kamailio[5333]: ALERT: <core>
>>>>> [main.c:754]: core was not generated
>>>>> Jun 12 15:20:16 myserver2 /usr/sbin/kamailio[5393]: DEBUG: <core>
>>>>> [io_wait.h:617]: DBG: io_watch_del (0x825cec0, 30, -1, 0x0) fd_no=65
>>>>> called
>>>>> Jun 12 15:20:16 myserver2 /usr/sbin/kamailio[5333]: INFO: <core>
>>>>> [main.c:766]: INFO: terminating due to SIGCHLD
>>>>> Jun 12 15:20:16 myserver2 /usr/sbin/kamailio[5392]: INFO: <core>
>>>>> [main.c:817]: INFO: signal 15 received
>>>>> Jun 12 15:20:16 myserver2 /usr/sbin/kamailio[5391]: INFO: <core>
>>>>> [main.c:817]: INFO: signal 15 received
>>>>> ... ...
>>>>> "
>>>>>
>>>>> Thanks very much!
>>>>>
>>>>> Yufei
>>>>>
>>>>> On 12/06/12 10:53, Daniel-Constantin Mierla wrote:
>>>>>> Hello,
>>>>>>
>>>>>> On 6/1/12 4:57 PM, Yufei Tao wrote:
>>>>>>> Hi
>>>>>>>
>>>>>>> I'm using drouting module and seems that it only allows digit-only
>>>>>>> prefixes. Also all the number of digits to be stripped ('strip'
>>>>>>> defined
>>>>>>> in dr_gateways) must be all digits too. When I used non-digits in
>>>>>>> these,
>>>>>>> Kamailio crashed.
>>>>>>>
>>>>>>> Is there any way in drouting module that I can use prefixes with
>>>>>>> alphabet and dots, e.g. "gateway1."? Thanks very much!
>>>>>> iirc, drouting accepts only digit based prefixes. Alphanumeric keys
>>>>>> are not suitable for tree structures, like used by drouting, because
>>>>>> there will be soo many children for each node that will use lot of
>>>>>> memory.
>>>>>>
>>>>>> Anyhow, it should not crash, do you have a backtrace or a log for it?
>>>>>>
>>>>>> Maybe you can combine several modules to get you go, if you want to
>>>>>> use drouting. Like using mtree (it has a way to define the characters
>>>>>> allowed in the prefixes -- still not suitable for all the characters)
>>>>>> or htable to map your alphanumeric key to a digit only key. Then you
>>>>>> can use the result with drouting.
>>>>>>
>>>>>>
>>>>>> Cheers,
>>>>>> Daniel
>>>>>>
>>>>>>> Yufei
>>>>>>> --
>>>>>>> Yufei Tao
>>>>>>> Red Embedded
>>>>>>>
>>>>>>> This E-mail and any attachments hereto are strictly confidential and
>>>>>>> intended solely for the addressee. If you are not the intended
>>>>>>> addressee please notify the sender by return and delete the message.
>>>>>>>
>>>>>>> You must not disclose, forward or copy this E-mail or attachments to
>>>>>>> any third party without the prior consent of the sender.
>>>>>>>
>>>>>>> Red Embedded Design, Company Number 06688253 Registered in England:
>>>>>>> The Waterfront, Salts Mill Rd, Saltaire, BD17 7EZ
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing
>>>>>>> list
>>>>>>> sr-users at lists.sip-router.org
>>>>>>> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>>>>> --
>>>>> Yufei Tao
>>>>> Red Embedded
>>>>>
>>>>> This E-mail and any attachments hereto are strictly confidential and
>>>>> intended solely for the addressee. If you are not the intended
>>>>> addressee please notify the sender by return and delete the message.
>>>>>
>>>>> You must not disclose, forward or copy this E-mail or attachments to
>>>>> any third party without the prior consent of the sender.
>>>>>
>>>>> Red Embedded Design, Company Number 06688253 Registered in England:
>>>>> The Waterfront, Salts Mill Rd, Saltaire, BD17 7EZ
>>> --
>>> Yufei Tao
>>> Red Embedded
>>>
>>> This E-mail and any attachments hereto are strictly confidential and
>>> intended solely for the addressee. If you are not the intended
>>> addressee please notify the sender by return and delete the message.
>>>
>>> You must not disclose, forward or copy this E-mail or attachments to
>>> any third party without the prior consent of the sender.
>>>
>>> Red Embedded Design, Company Number 06688253 Registered in England:
>>> The Waterfront, Salts Mill Rd, Saltaire, BD17 7EZ
> --
> Yufei Tao
> Red Embedded
>
> This E-mail and any attachments hereto are strictly confidential and intended solely for the addressee. If you are not the intended addressee please notify the sender by return and delete the message.
>
> You must not disclose, forward or copy this E-mail or attachments to any third party without the prior consent of the sender.
>
> Red Embedded Design, Company Number 06688253 Registered in England: The Waterfront, Salts Mill Rd, Saltaire, BD17 7EZ

-- 
Daniel-Constantin Mierla - http://www.asipto.com
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Kamailio Advanced Training, Seattle, USA, Sep 23-26, 2012 - http://asipto.com/u/katu
Kamailio Practical Workshop, Netherlands, Sep 10-12, 2012 - http://asipto.com/u/kpw






More information about the sr-users mailing list