I think we should set that modparam by default to 1, it is what people would like more to have when using lua -- the option to reload the lua scripts, disabling it would be the exception, IMO. Other opinions?

Cheers,
Daniel


On 03.04.18 19:55, Igor Olhovskiy wrote:
My bad with reload, sorry )

Missed
modparam("app_lua", "reload", 1)

Regards, Igor

On Apr 3, 2018, 7:08 PM +0300, Daniel-Constantin Mierla <miconda@gmail.com>, wrote:

Thanks, it was easy to spot from the gdb backtrace -- this was due to an issue introduced by commit f775e4000e in master branch. I pushed a fix to it, try again with latest master.

Cheers,
Daniel


On 03.04.18 16:31, Igor Olhovskiy wrote:
Core was generated by `/usr/local/sbin/kamailio -P /var/run/kamailio/kamailio.pid -f /usr/local/etc/ka'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00000000005b31c2 in rec_lock_set_release (lset=0x0, i=0) at core/locking.c:154
154 rec_lock_release(&lset->locks[i]);
(gdb) bt full
#0  0x00000000005b31c2 in rec_lock_set_release (lset=0x0, i=0) at core/locking.c:154
No locals.
#1  0x000000000056424c in receive_msg (
    buf=0xa439c0 <buf> "SIP/2.0 200 OK\r\nVia: SIP/2.0/UDP 94.130.73.135;branch=z9hG4bKea4e.fcaca0cb6a039868d0cbb85929bd3b59.0;received=140.82.63.219\r\nVia: SIP/2.0/UDP 94.130.106.214:5060;received=94.130.106.214;rport=5060;bra"...,
    len=598, rcv_info=0x7ffc7b4c07b0) at core/receive.c:401
        msg = 0x7f53bd483ee8
        ctx = {rec_lev = 0, run_flags = 0, last_retcode = 0, jmp_env = {{__jmpbuf = {139997642541328, 139997652819968, 8317129406208278527, 6746573, 0, 139997646292064, 0, 140722377065504}, __mask_was_saved = 575228262, __saved_mask = {
                __val = {598, 7908744, 140722377067632, 0, 0, 140722377066640, 139997642804455, 799, 206158430256, 140722377065824, 140722377065584, 0, 139997642804770, 5, 14631, 7908744}}}}}
        bctx = 0x0
        ret = 1
        stats_on = 0
        tvb = {tv_sec = 1522765677, tv_usec = 355411}
        tve = {tv_sec = 1522728960, tv_usec = 0}
        tz = {tz_minuteswest = 0, tz_dsttime = 0}
        diff = 0
        inb = {
          s = 0xa439c0 <buf> "SIP/2.0 200 OK\r\nVia: SIP/2.0/UDP 94.130.73.135;branch=z9hG4bKea4e.fcaca0cb6a039868d0cbb85929bd3b59.0;received=140.82.63.219\r\nVia: SIP/2.0/UDP 94.130.106.214:5060;received=94.130.106.214;rport=5060;bra"..., len = 598}
        netinfo = {data = {s = 0x7ffc7b4c05a7 "ia: SIP/2.0/UDP 94.130.73.135;branch=z9hG4bKea4e.fcaca0cb6a039868d0cbb85929bd3b59.0quests\005", len = 0}, rcv = 0x0, dst = 0x0}
        keng = 0xa59a40 <_sr_kemi_eng_list>
        evp = {data = 0x7ffc7b4c0380, rcv = 0x7ffc7b4c07b0, dst = 0x0}
        cidlockidx = 0
        cidlockset = 0
        __FUNCTION__ = "receive_msg"
#2  0x0000000000459b21 in udp_rcv_loop () at core/udp_server.c:554
        len = 598
        buf = "SIP/2.0 200 OK\r\nVia: SIP/2.0/UDP 94.130.73.135;branch=z9hG4bKea4e.fcaca0cb6a039868d0cbb85929bd3b59.0;received=140.82.63.219\r\nVia: SIP/2.0/UDP 94.130.106.214:5060;received=94.130.106.214;rport=5060;bra"...
        tmp = 0x7ffc7b4c09d0 "\220\vL{\374\177"
        from = 0x7f53bd4820d0
        fromlen = 16
        ri = {src_ip = {af = 2, len = 4, u = {addrl = {140721838909616, 0}, addr32 = {1530423472, 32764, 0, 0}, addr16 = {26800, 23352, 32764, 0, 0, 0, 0, 0}, addr = "\260h8[\374\177\000\000\000\000\000\000\000\000\000"}}, dst_ip = {
            af = 2, len = 4, u = {addrl = {3678360204, 0}, addr32 = {3678360204, 0, 0, 0}, addr16 = {21132, 56127, 0, 0, 0, 0, 0, 0}, addr = "\214R?\333", '\000' <repeats 11 times>}}, src_port = 51259, dst_port = 5060,
          proto_reserved1 = 0, proto_reserved2 = 0, src_su = {s = {sa_family = 2, sa_data = "\310;\260h8[\000\000\000\000\000\000\000"}, sin = {sin_family = 2, sin_port = 15304, sin_addr = {s_addr = 1530423472},
              sin_zero = "\000\000\000\000\000\000\000"}, sin6 = {sin6_family = 2, sin6_port = 15304, sin6_flowinfo = 1530423472, sin6_addr = {__in6_u = {__u6_addr8 = '\000' <repeats 15 times>, __u6_addr16 = {0, 0, 0, 0, 0, 0, 0, 0},
                  __u6_addr32 = {0, 0, 0, 0}}}, sin6_scope_id = 0}}, bind_address = 0x7f53bd474080, proto = 1 '\001'}
        evp = {data = 0x0, rcv = 0x0, dst = 0x0}
        printbuf = "SIP/2.0 200 OK 0D  0A Via: SIP/2.0/UDP 94.130.73.135;branch=z9hG4bKea4e.fcaca0cb6a039868d0cbb85929bd3b59.0quests\005\000\000\000\000\000\000\000'9\000\000\000\000\000\000\210\255x\000\000\000\000\000\312\334طS\177\000\000ck(packe\273\a\255\267S\177\000\000from-dom\020\002\000\000\000\000\000\000subscrib\000\000\000\000\000\000\000\000\360fB\001\000\000\000\000\377\377\377\377"...
        i = 100
        j = 106
        l = 4
        __FUNCTION__ = "udp_rcv_loop"
#3  0x000000000042339d in main_loop () at main.c:1628
        i = 0
        pid = 0
        si = 0x7f53bd474080
        si_desc = "udp receiver child=0 sock=140.82.63.219:5060\000\000\000\000\220\vL{\374\177\000\000\347\314ĽS\177\000\000 \tL{\374\177\000\000\060\000\000\000\060\000\000\000\340\tL{\374\177\000\000\020\tL{\374\177", '\000' <repeats 14 times>, "\001", '\000' <repeats 11 times>, "!9\000\000\000\000\000"
        nrprocs = 4
        woneinit = 1
        __FUNCTION__ = "main_loop"
#4  0x000000000042a8a8 in main (argc=15, argv=0x7ffc7b4c0c78) at main.c:2650
        cfg_stream = 0x1376010
---Type <return> to continue, or q <return> to quit---
        c = -1
        r = 0
        tmp = 0x7ffc7b4c0f12 ""
        tmp_len = 32595
        port = -1103316627
        proto = 0
        options = 0x746dd0 ":f:cm:M:dVIhEeb:l:L:n:vKrRDTN:W:w:t:u:g:P:G:SQ:O:a:A:x:X:Y:"
        ret = -1
        seed = 1592049986
        rfd = 4
        debug_save = 0
        debug_flag = 0
        dont_fork_cnt = 0
        n_lst = 0x7ffc7b4c0b30
        p = 0x7ffc7b4c0cf8 "8\017L{\374\177"
        st = {st_dev = 15, st_ino = 285409, st_nlink = 2, st_mode = 16877, st_uid = 107, st_gid = 112, __pad0 = 0, st_rdev = 0, st_size = 40, st_blksize = 4096, st_blocks = 0, st_atim = {tv_sec = 1522765525, tv_nsec = 737178002},
          st_mtim = {tv_sec = 1522765595, tv_nsec = 469418892}, st_ctim = {tv_sec = 1522765595, tv_nsec = 469418892}, __glibc_reserved = {0, 0, 0}}
        __FUNCTION__ = "main"
(gdb)

2018-04-03 14:05 GMT+03:00 Daniel-Constantin Mierla <miconda@gmail.com>:

Can you run as root in the terminal:

ulimit -c unlimited

Start kamailio in the same terminal, adding extra parameters '-w /tmp'

Reproduce the case and you should get a core file in /tmp if kamailio crashes. Grab the backtrace with gdb and send it here.

Cheers,
Daniel


On 03.04.18 11:48, Igor Olhovskiy wrote:
Ok.

This time other issue

LUA {SUBSCRIBE}:  7(14332) DEBUG: app_lua [app_lua_api.c:716]: app_lua_run_ex(): ksr error call from Lua: ~~ksr~exit~~
LUA {SUBSCRIBE}:  7(14332) DEBUG: app_lua [app_lua_mod.c:171]: sr_kemi_config_engine_lua(): execution of route type 1 with no name returned 1
LUA {SUBSCRIBE}:  7(14332) INFO: <core> [core/receive.c:344]: receive_msg(): request-route executed in: 3639 usec
LUA {SUBSCRIBE}:  7(14332) DEBUG: <core> [core/usr_avp.c:636]: destroy_avp_list(): destroying list (nil)
LUA {SUBSCRIBE}:  7(14332) DEBUG: <core> [core/usr_avp.c:636]: destroy_avp_list(): destroying list (nil)
LUA {SUBSCRIBE}:  7(14332) DEBUG: <core> [core/usr_avp.c:636]: destroy_avp_list(): destroying list (nil)
LUA {SUBSCRIBE}:  7(14332) DEBUG: <core> [core/usr_avp.c:636]: destroy_avp_list(): destroying list (nil)
LUA {SUBSCRIBE}:  7(14332) DEBUG: <core> [core/usr_avp.c:636]: destroy_avp_list(): destroying list (nil)
LUA {SUBSCRIBE}:  7(14332) DEBUG: <core> [core/usr_avp.c:636]: destroy_avp_list(): destroying list (nil)
LUA {SUBSCRIBE}:  7(14332) DEBUG: <core> [core/xavp.c:446]: xavp_destroy_list(): destroying xavp list (nil)
LUA {SUBSCRIBE}:  7(14332) DEBUG: <core> [core/receive.c:448]: receive_msg(): cleaning up
kernel: [263424.485205] kamailio[14333]: segfault at 8 ip 00000000005b31c2 sp 00007fffc1777210 error 4 in kamailio[400000+438000]

Kamailio just segfault on reply route on SUBSCRIBE?

What to add to compile options to make this message more clear?

Regards, Igor

On Apr 3, 2018, 11:14 AM +0300, Daniel-Constantin Mierla <miconda@gmail.com>, wrote:

Hello,

indeed, I did a rename to make it more clear the purpose of a drop-related function, breaking the use from other modules.

I pushed the commits to fix the issue, try again with latest master.

Cheers,
Daniel


On 03.04.18 10:01, Igor Olhovskiy wrote:
Hi! 

As of now app_lua is could not be loaded by Kamailio at all. 

kamailio: ERROR: <core> [core/sr_module.c:582]: load_module(): could not open module </usr/local/lib64/kamailio/modules/app_lua.so>: /usr/local/lib64/kamailio/modules/app_lua.so: undefined symbol: sr_kemi_core_drop


PS:
Latest commit on git:
commit a5dd60c8d7e04731f12108838a3c82149e04ef9c Author: Daniel-Constantin Mierla <mailto:miconda@gmail.com> Date: Tue Apr 3 09:27:19 2018 +0200 ipops: mask subnet address for ipv6 comparison - coherent with ipv4 behaviou

Regards, Igor

On Apr 2, 2018, 9:18 AM +0300, Daniel-Constantin Mierla <miconda@gmail.com>, wrote:

Hello,

do you have pkg-config installed? This is a tool that helps locating libs and include files.

Cheers,
Daniel


On 31.03.18 11:13, Igor Olhovskiy wrote:
Hi!

A bit dumb question - how to specify lua.h file path to make command? It looks in 

ls: cannot access /usr/local/lib/liblua*: No such file or directory
ls: cannot access /usr/local/lib/liblua*: No such file or directory
CC (gcc) [M app_lua.so] app_lua_mod.o
In file included from app_lua_mod.c:34:0:
app_lua_api.h:25:17: fatal error: lua.h: No such file or directory
 #include <lua.h>
                 ^

But i’ve installed via apt-get install liblua5.2-dev, and lua.h is located at /usr/include/lua5.2/

Regards, Igor

On Mar 30, 2018, 6:41 PM +0300, Daniel-Constantin Mierla <miconda@gmail.com>, wrote:

Hello,

can you test with master branch, I pushed a commit for it -- if all ok, I will backport.

Cheers,
Daniel


On 30.03.18 14:47, Igor Olhovskiy wrote:
Hi!

Seems calling function KSR.sqlops.sql_num_rows(«sql_res») crashes Kamailio. At least I got this at 5.1.2 from debian repos with LUA.

Getting smth like

dev1 kernel: [5780693.247255] kamailio[20659]: segfault at 50b300000004 ip 00007f34d2f46fd6 sp 00007ffe1f0ac310 error 4 in sqlops.so[7f34d2f42000+1c000]

Regards, Igor


_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

--     
Daniel-Constantin Mierla
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Kamailio Advanced Training - April 16-18, 2018, Berlin - www.asipto.com
Kamailio World Conference - May 14-16, 2018 - www.kamailioworld.com

--    
Daniel-Constantin Mierla
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Kamailio Advanced Training - April 16-18, 2018, Berlin - www.asipto.com
Kamailio World Conference - May 14-16, 2018 - www.kamailioworld.com

--   
Daniel-Constantin Mierla
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Kamailio Advanced Training - April 16-18, 2018, Berlin - www.asipto.com
Kamailio World Conference - May 14-16, 2018 - www.kamailioworld.com

--  
Daniel-Constantin Mierla
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Kamailio Advanced Training - April 16-18, 2018, Berlin - www.asipto.com
Kamailio World Conference - May 14-16, 2018 - www.kamailioworld.com



--
Best regards,
Igor

--  
Daniel-Constantin Mierla
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Kamailio Advanced Training - April 16-18, 2018, Berlin - www.asipto.com
Kamailio World Conference - May 14-16, 2018 - www.kamailioworld.com

-- 
Daniel-Constantin Mierla
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Kamailio Advanced Training - April 16-18, 2018, Berlin - www.asipto.com
Kamailio World Conference - May 14-16, 2018 - www.kamailioworld.com