{"action":"created","issue":{"url":"https://api.github.com/repos/kamailio/kamailio/issues/360","labels_url":"https://api.github.com/repos/kamailio/kamailio/issues/360/labels{/name}","comments_url":"https://api.github.com/repos/kamailio/kamailio/issues/360/comments","events_url":"https://api.github.com/repos/kamailio/kamailio/issues/360/events","html_url":"https://github.com/kamailio/kamailio/issues/360","id":110053089,"number":360,"title":"segmentation fault when mongodb & tls enabled. ( kamailio 4.3.2)","user":{"login":"jijo2010","id":11263912,"avatar_url":"https://avatars.githubusercontent.com/u/11263912?v=3","gravatar_id":"","url":"https://api.github.com/users/jijo2010","html_url":"https://github.com/jijo2010","followers_url":"https://api.github.com/users/jijo2010/followers","following_url":"https://api.github.com/users/jijo2010/following{/other_user}","gists_url":"https://api.github.com/users/jijo2010/gists{/gist_id}","starred_url":"https://api.github.com/users/jijo2010/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jijo2010/subscriptions","organizations_url":"https://api.github.com/users/jijo2010/orgs","repos_url":"https://api.github.com/users/jijo2010/repos","events_url":"https://api.github.com/users/jijo2010/events{/privacy}","received_events_url":"https://api.github.com/users/jijo2010/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-10-06T16:56:57Z","updated_at":"2015-11-03T16:42:54Z","closed_at":null,"body":"I'm observing a segmentation fault when mongodb & tls enabled. It doesn't happen when one of the module is disabled.\r\nOS: centos 6.7   kamailio 4.3.2  mongo-c-driver version 1.1.10.\r\n\r\nIt happens immediately after i register a subscriber. The location table is updated with the new data and in parallel core is generated as well.\r\nI'm running with the offical kamailio script by just enabling mongo modules. It happens for NDB as well.\r\n\r\nHow did you build the mongo driver when you implemented it? May be i can try the same.\r\n\r\nPlease find the scripts used for testing in the email.\r\n\r\nCore was generated by `/usr/sbin/kamailio -P /var/run/kamailio.pid -m 64 -M 8'.\r\n\r\nProgram terminated with signal 11, Segmentation fault.\r\n\r\n#0  0x00007f85a21da075 in lock_udomain (_d=0x7f859c7b5f08, _aor=0x7fff6de7ef70) at udomain.c:1017\r\n\r\n1017\tlock_get(_d->table[sl].lock);\r\n\r\nMissing separate debuginfos, use: debuginfo-install cyrus-sasl-lib-2.1.23-15.el6_6.2.x86_64 cyrus-sasl-plain-2.1.23-15.el6_6.2.x86_64 db4-4.7.25-19.el6_6.x86_64 glibc-2.12-1.166.el6_7.1.x86_64 keyutils-libs-1.4-5.el6.x86_64 krb5-libs-1.10.3-42.el6.x86_64 libcom_err-1.41.12-22.el6.x86_64 libselinux-2.0.94-5.8.el6.x86_64 nss-softokn-freebl-3.14.3-22.el6_6.x86_64 openssl-1.0.1e-42.el6.x86_64 zlib-1.2.3-29.el6.x86_64\r\n\r\n(gdb) bt\r\n\r\n#0  0x00007f85a21da075 in lock_udomain (_d=0x7f859c7b5f08, _aor=0x7fff6de7ef70) at udomain.c:1017\r\n\r\n#1  0x00007f85a1d7069b in add_contacts (_m=0x7f85a3f054b8, _d=0x7f859c7b5f08, _a=0x7fff6de7ef70, _mode=0, _use_regid=1) at save.c:831\r\n\r\n#2  0x00007f85a1d72602 in save (_m=0x7f85a3f054b8, _d=0x7f859c7b5f08, _cflags=0, _uri=0x0) at save.c:986\r\n\r\n#3  0x00007f85a1d5975a in w_save2 (_m=0x7f85a3f054b8, _d=0x7f859c7b5f08 \"h^{\\234\\205\\177\", _cflags=0x0) at reg_mod.c:414\r\n\r\n#4  0x000000000041decb in do_action (h=0x7fff6de7f720, a=0x7f85a3edd830, msg=0x7f85a3f054b8) at action.c:1059\r\n\r\n#5  0x000000000042a553 in run_actions (h=0x7fff6de7f720, a=0x7f85a3edd830, msg=0x7f85a3f054b8) at action.c:1548\r\n\r\n#6  0x000000000042abb8 in run_actions_safe (h=0x7fff6de80a10, a=0x7f85a3edd830, msg=0x7f85a3f054b8) at action.c:1613\r\n\r\n#7  0x0000000000543d50 in rval_get_int (h=0x7fff6de80a10, msg=0x7f85a3f054b8, i=0x7fff6de7fbf8, rv=0x7f85a3edf478, cache=0x0) at rvalue.c:912\r\n\r\n#8  0x0000000000547f88 in rval_expr_eval_int (h=0x7fff6de80a10, msg=0x7f85a3f054b8, res=0x7fff6de7fbf8, rve=0x7f85a3edf470) at rvalue.c:1906\r\n\r\n#9  0x000000000054837e in rval_expr_eval_int (h=0x7fff6de80a10, msg=0x7f85a3f054b8, res=0x7fff6de80080, rve=0x7f85a3edfb70) at rvalue.c:1914\r\n\r\n#10 0x000000000041d927 in do_action (h=0x7fff6de80a10, a=0x7f85a3ee0270, msg=0x7f85a3f054b8) at action.c:1029\r\n\r\n#11 0x000000000042a553 in run_actions (h=0x7fff6de80a10, a=0x7f85a3edc990, msg=0x7f85a3f054b8) at action.c:1548\r\n\r\n#12 0x000000000041a8c3 in do_action (h=0x7fff6de80a10, a=0x7f85a3ebdd98, msg=0x7f85a3f054b8) at action.c:677\r\n\r\n#13 0x000000000042a553 in run_actions (h=0x7fff6de80a10, a=0x7f85a3ebdb08, msg=0x7f85a3f054b8) at action.c:1548\r\n\r\n#14 0x000000000042ac80 in run_top_route (a=0x7f85a3ebdb08, msg=0x7f85a3f054b8, c=0x0) at action.c:1634\r\n\r\n#15 0x000000000050a9f4 in receive_msg (\r\n\r\n    buf=0xa70b00 \"REGISTER sip:192.168.2.142 SIP/2.0\\r\\nVia: SIP/2.0/UDP 192.168.2.119:60887;branch=z9hG4bK-524287-1---d670bd2004732b4a;rport\\r\\nMax-Forwards: 70\\r\\nContact: <sip:usera@192.168.2.119:60887;rinstance=d9f6274d7\"..., len=534, rcv_info=0x7fff6de80d00) at receive.c:196\r\n\r\n#16 0x000000000060a4a6 in udp_rcv_loop () at udp_server.c:495\r\n\r\n#17 0x00000000004a7fb3 in main_loop () at main.c:1573\r\n\r\n#18 0x00000000004ae38e in main (argc=7, argv=0x7fff6de81138) at main.c:2533\r\n\r\n(gdb) quit"},"comment":{"url":"https://api.github.com/repos/kamailio/kamailio/issues/comments/153410984","html_url":"https://github.com/kamailio/kamailio/issues/360#issuecomment-153410984","issue_url":"https://api.github.com/repos/kamailio/kamailio/issues/360","id":153410984,"user":{"login":"jijo2010","id":11263912,"avatar_url":"https://avatars.githubusercontent.com/u/11263912?v=3","gravatar_id":"","url":"https://api.github.com/users/jijo2010","html_url":"https://github.com/jijo2010","followers_url":"https://api.github.com/users/jijo2010/followers","following_url":"https://api.github.com/users/jijo2010/following{/other_user}","gists_url":"https://api.github.com/users/jijo2010/gists{/gist_id}","starred_url":"https://api.github.com/users/jijo2010/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jijo2010/subscriptions","organizations_url":"https://api.github.com/users/jijo2010/orgs","repos_url":"https://api.github.com/users/jijo2010/repos","events_url":"https://api.github.com/users/jijo2010/events{/privacy}","received_events_url":"https://api.github.com/users/jijo2010/received_events","type":"User","site_admin":false},"created_at":"2015-11-03T16:42:53Z","updated_at":"2015-11-03T16:42:53Z","body":"Program terminated with signal 11, Segmentation fault.\r\n#0  0x00007f7963c9e97e in db_mongodb_query (_h=0x7f7968437cd8, _k=0x0, _op=0x0, _v=0x0, _c=0x7ffc7373ba40, _n=0, _nc=21, _o=0x0, _r=0x7ffc7373ba38) at mongodb_dbase.c:846\r\n846\t\tif(CON_TABLE(_h)->s[CON_TABLE(_h)->len]!='\\0') {\r\nMissing separate debuginfos, use: debuginfo-install cyrus-sasl-lib-2.1.23-15.el6_6.2.x86_64 cyrus-sasl-plain-2.1.23-15.el6_6.2.x86_64 db4-4.7.25-20.el6_7.x86_64 glibc-2.12-1.166.el6_7.3.x86_64 keyutils-libs-1.4-5.el6.x86_64 krb5-libs-1.10.3-42.el6.x86_64 libcom_err-1.41.12-22.el6.x86_64 libcurl-7.19.7-46.el6.x86_64 libidn-1.18-2.el6.x86_64 libselinux-2.0.94-5.8.el6.x86_64 libssh2-1.4.2-1.el6_6.1.x86_64 libunistring-0.9.3-5.el6.x86_64 libxml2-2.7.6-20.el6.x86_64 mysql-libs-5.1.73-5.el6_6.x86_64 nspr-4.10.8-1.el6_6.x86_64 nss-3.18.0-5.3.el6_6.x86_64 nss-softokn-freebl-3.14.3-22.el6_6.x86_64 nss-util-3.18.0-1.el6_6.x86_64 openldap-2.4.40-5.el6.x86_64 openssl-1.0.1e-42.el6.x86_64 zlib-1.2.3-29.el6.x86_64\r\n(gdb) bt\r\n#0  0x00007f7963c9e97e in db_mongodb_query (_h=0x7f7968437cd8, _k=0x0, _op=0x0, _v=0x0, _c=0x7ffc7373ba40, _n=0, _nc=21, _o=0x0, _r=0x7ffc7373ba38) at mongodb_dbase.c:846\r\n#1  0x00007f7960ae663c in preload_udomain (_c=0x7f7968437cd8, _d=0x7f7963ef8f20) at udomain.c:432\r\n#2  0x00007f7960af7f87 in child_init (_rank=1) at ul_mod.c:437\r\n#3  0x00000000005940ed in init_mod_child (m=0x7f7968380b18, rank=1) at sr_module.c:898\r\n#4  0x0000000000593e28 in init_mod_child (m=0x7f7968380e00, rank=1) at sr_module.c:895\r\n#5  0x0000000000593e28 in init_mod_child (m=0x7f7968381558, rank=1) at sr_module.c:895\r\n#6  0x0000000000593e28 in init_mod_child (m=0x7f7968382250, rank=1) at sr_module.c:895\r\n#7  0x0000000000593e28 in init_mod_child (m=0x7f7968382b90, rank=1) at sr_module.c:895\r\n#8  0x0000000000593e28 in init_mod_child (m=0x7f79683830c8, rank=1) at sr_module.c:895\r\n#9  0x0000000000593e28 in init_mod_child (m=0x7f7968383458, rank=1) at sr_module.c:895\r\n#10 0x0000000000593e28 in init_mod_child (m=0x7f7968383948, rank=1) at sr_module.c:895\r\n#11 0x0000000000593e28 in init_mod_child (m=0x7f7968384ed8, rank=1) at sr_module.c:895\r\n#12 0x0000000000593e28 in init_mod_child (m=0x7f79683853f0, rank=1) at sr_module.c:895\r\n#13 0x0000000000593e28 in init_mod_child (m=0x7f79683857a0, rank=1) at sr_module.c:895\r\n#14 0x0000000000593e28 in init_mod_child (m=0x7f7968385b50, rank=1) at sr_module.c:895\r\n#15 0x0000000000593e28 in init_mod_child (m=0x7f7968385ee0, rank=1) at sr_module.c:895\r\n#16 0x0000000000593e28 in init_mod_child (m=0x7f7968386550, rank=1) at sr_module.c:895\r\n#17 0x0000000000593e28 in init_mod_child (m=0x7f7968386f40, rank=1) at sr_module.c:895\r\n#18 0x00000000005943f7 in init_child (rank=1) at sr_module.c:924\r\n#19 0x00000000004ebdf5 in fork_tcp_process (child_id=1, desc=0x7ffc7373c8c0 \"tcp receiver (generic)\", r=0, reader_fd_1=0x7ffc7373c940) at pt.c:465\r\n#20 0x00000000005e20bf in tcp_init_children () at tcp_main.c:4777\r\n#21 0x00000000004a8ba1 in main_loop () at main.c:1658\r\n#22 0x00000000004ae38e in main (argc=15, argv=0x7ffc7373cce8) at main.c:2533\r\n(gdb) info locals\r\ni = 0\r\nmgcon = 0x7f7968437e60\r\nclient = 0x1988fb0\r\nseldoc = 0x0\r\ncname = 0x7ffc7373ba80 \"\\260\\374\\320`y\\177\"\r\nb1 = 0 '\\000'\r\njstr = 0xd0e12daad083a4fd <Address 0xd0e12daad083a4fd out of bounds>\r\n__FUNCTION__ = \"db_mongodb_query\"\r\n(gdb) list\r\n841\t\t}\r\n842\t\r\n843\t\tif(_r) *_r = NULL;\r\n844\t\r\n845\t\tb1 = '\\0';\r\n846\t\tif(CON_TABLE(_h)->s[CON_TABLE(_h)->len]!='\\0') {\r\n847\t\t\tb1 = CON_TABLE(_h)->s[CON_TABLE(_h)->len];\r\n848\t\t\tCON_TABLE(_h)->s[CON_TABLE(_h)->len] = '\\0';\r\n849\t\t}\r\n850\t\tcname = CON_TABLE(_h)->s;\r\n(gdb) p _h\r\n$1 = (const db1_con_t *) 0x7f7968437cd8\r\n(gdb) p *_h\r\n$2 = {table = 0x7f7963ef81c0, tquote = 0x0, tail = 140159417024096}\r\n(gdb) p _h->table\r\n$3 = (const str *) 0x7f7963ef81c0\r\n(gdb) p *_h->table\r\n$4 = {s = 0x7f79ffffffff <Address 0x7f79ffffffff out of bounds>, len = 8}\r\n(gdb) \r\n"}}