<!-- Kamailio Project uses GitHub Issues only for bugs in the code or feature requests. Please use this template only for bug reports.
If you have questions about using Kamailio or related to its configuration file, ask on sr-users mailing list:
* http://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
If you have questions about developing extensions to Kamailio or its existing C code, ask on sr-dev mailing list:
* http://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev
Please try to fill this template as much as possible for any issue. It helps the developers to troubleshoot the issue.
If there is no content to be filled in a section, the entire section can be removed.
You can delete the comments from the template sections when filling.
You can delete next line and everything above before submitting (it is a comment). --> Kamailio 5.3 app_ruby crash with example config,kamailio 5.2 withj same config and ruby not this isue
<!-- I try example app_ruby from app_ruby mod documentation and kamailio crash after call ruby method.
example ruby script: cat /var/kamailio/ruby/test.rb def info(si) KSR.info("==== from ruby - src ip: #{si} - #{KSR.is_INVITE} - #{KSR::PV.get("$si")}\n") #KSR.info("==== from ruby - src ip: #{si} - #{KSR.is_INVITE} - #{KSR::PV.sets("$var(tmp)","123456")},#{KSR::PV.get("$si")}\n") KSR::PV.seti("$var(tmp)",12345) KSR::SL.sl_send_reply(200, "OK-Ruby") end
kamailio config: loadmodule "app_ruby.so" modparam("app_ruby", "load", "/var/kamailio/ruby/test.rb") .... # handle requests within SIP dialogs route(WITHINDLG);
### only initial requests (no To tag)
# authentication route(AUTH);
# record routing for dialog forming requests (in case they are routed) # - remove preloaded route headers remove_hf("Route"); if (is_method("INVITE|SUBSCRIBE")) { record_route(); if(!ruby_run("info","$si")) { xdbg("SCRIPT: failed to execute ruby function!\n"); } xlog("L_INFO","RUBY -- $var(tmp)"); } ...... -->
### Troubleshooting
#### Reproduction Install latest ruby from source: https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.5.tar.bz2
Install kamailio 5.3 from git.
<!-- If the issue can be reproduced, describe how it can be done. -->
#### Debugging Data bt full info locals list:
[New LWP 6828] [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". 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 0x00007f2affe9cfbe in rb_current_thread () at vm_core.h:1742 1742 return rb_ec_thread_ptr(ec); #0 0x00007f2affe9cfbe in rb_current_thread () at vm_core.h:1742 ec = 0x0 ec = <optimized out> #1 ruby_cleanup (ex=0) at eval.c:178 state = <optimized out> errs = {8388608, 7192328} th = <optimized out> nerr = <optimized out> sysex = 0 step = 0 #2 0x00007f2b0012dc40 in ruby_sr_destroy () at app_ruby_api.c:219 No locals. #3 0x00007f2b0014c166 in mod_destroy () at app_ruby_mod.c:122 No locals. #4 0x00005647515cc367 in destroy_modules () at core/sr_module.c:746 t = 0x7f2b013852f8 foo = 0x7f2b01384488 __func__ = "destroy_modules" #5 0x0000564751478aef in cleanup (show_status=1) at main.c:555 memlog = 1953722216 __func__ = "cleanup" #6 0x000056475147a4e3 in shutdown_children (sig=15, show_status=1) at main.c:696 __func__ = "shutdown_children" #7 0x000056475147d443 in handle_sigs () at main.c:796 chld = 0 chld_status = 134 any_chld_stopped = 1 memlog = -104142504 __func__ = "handle_sigs" #8 0x0000564751487413 in main_loop () at main.c:1806 i = 8 pid = 6871 si = 0x0 si_desc = "udp receiver child=7 sock=192.168.144.33:5060\000\000\000\000\3\271\377\177\000\000\243I\206QGV\000\000\000\000\000\004\000\000\000\000\000\000\200\000\000\000\000\000\006\000\000\000\000\000\000\000Lm\275\001+\177\000\000\060\000\000\000\060\000\000\000 X3\271\377\177\000\000PW3\271\377\177\000\000\bN?\001+\177\000" nrprocs = 8 woneinit = 1 __func__ = "main_loop" #9 0x000056475148ea71 in main (argc=15, argv=0x7fffb9335ce8) at main.c:2802 cfg_stream = 0x564752519260 c = -1 r = 0 tmp = 0x7fffb93369f0 "" tmp_len = 32555 port = 29769255 proto = 32555 ahost = 0x0 aport = 0 options = 0x56475180db40 ":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 = 2159776292 rfd = 4 debug_save = 0 debug_flag = 0 dont_fork_cnt = 0 n_lst = 0x0 p = 0x7f2b01b85af5 <handle_intel+197> "H\205\300uf\213t$\004M\215\216\244" st = {st_dev = 145, st_ino = 18, st_nlink = 2, st_mode = 16832, st_uid = 101, st_gid = 107, __pad0 = 0, st_rdev = 0, st_size = 40, st_blksize = 4096, st_blocks = 0, st_atim = {tv_sec = 1576675424, tv_nsec = 128734310}, st_mtim = {tv_sec = 1576675348, tv_nsec = 136871578}, st_ctim = {tv_sec = 1576675348, tv_nsec = 136871578}, __glibc_reserved = {0, 0, 0}} tbuf = "0Y3\271\377\177\000\000xX3\271\377\177\000\000\bU\316\001+\177\000\000\006\000\000\000\000\000\000\000\370\177\256\001", '\000' <repeats 16 times>, " \000\000\000\357\265\275\205\000\000\000\000\200M\316\001+\177\000\000\330Y3\271\377\177\000\000 J\316\001+\177\000\000\000\000\000\000\000\000\000\000\070Z\316\001+\177\000\000\217\203\317\001+\177\000\000\005\000\000\000\000\000\000\000\070Z\316\001+\177\000\000\001", '\000' <repeats 15 times>, "\001\000\000\000\000\000\000\000 J\316\001+\177\000\000\207\210\312\001+\177\000\000\000\000\000\000\001\000\000\000\060Y3\271\377\177\000\000@Y3\271\377\177\000\000\200M\316\001+\177\000\000\000\000\000\000\000\000\000\000"... option_index = 0 long_options = {{name = 0x56475181054a "help", has_arg = 0, flag = 0x0, val = 104}, {name = 0x56475180a46c "version", has_arg = 0, flag = 0x0, val = 118}, {name = 0x56475181054f "alias", has_arg = 1, flag = 0x0, val = 1024}, {name = 0x564751810555 "subst", has_arg = 1, flag = 0x0, val = 1025}, {name = 0x56475181055b "substdef", has_arg = 1, flag = 0x0, val = 1026}, {name = 0x564751810564 "substdefs", has_arg = 1, flag = 0x0, val = 1027}, {name = 0x56475181056e "server-id", has_arg = 1, flag = 0x0, val = 1028}, {name = 0x0, has_arg = 0, flag = 0x0, val = 0}} __func__ = "main" ec = 0x0 ec = <optimized out> 1737 1738 static inline rb_thread_t * 1739 rb_current_thread(void) 1740 { 1741 const rb_execution_context_t *ec = GET_EC(); 1742 return rb_ec_thread_ptr(ec); 1743 } 1744 1745 static inline rb_vm_t * 1746 rb_current_vm(void) <!-- If you got a core dump, use gdb to extract troubleshooting data - full backtrace, local variables and the list of the code at the issue location.
gdb /path/to/kamailio /path/to/corefile bt full info locals list
If you are familiar with gdb, feel free to attach more of what you consider to be relevant. -->
``` Dec 18 13:12:33 serZt2 /usr/local/sbin/kamailio[32308]: CRITICAL: <core> [core/pass_fd.c:277]: receive_fd(): EOF on 28 Dec 18 13:12:33 serZt2 /usr/local/sbin/kamailio[32276]: ALERT: <core> [main.c:766]: handle_sigs(): child process 32290 exited by a signal 6 Dec 18 13:12:33 serZt2 /usr/local/sbin/kamailio[32276]: ALERT: <core> [main.c:769]: handle_sigs(): core was generated Dec 18 13:12:33 serZt2 /usr/local/sbin/kamailio[32276]: INFO: <core> [main.c:792]: handle_sigs(): terminating due to SIGCHLD Dec 18 13:12:33 serZt2 /usr/local/sbin/kamailio[32307]: INFO: <core> [main.c:847]: sig_usr(): signal 15 received Dec 18 13:12:33 serZt2 /usr/local/sbin/kamailio[32303]: INFO: <core> [main.c:847]: sig_usr(): signal 15 received Dec 18 13:12:33 serZt2 /usr/local/sbin/kamailio[32277]: INFO: <core> [main.c:847]: sig_usr(): signal 15 received Dec 18 13:12:33 serZt2 /usr/local/sbin/kamailio[32299]: INFO: <core> [main.c:847]: sig_usr(): signal 15 received Dec 18 13:12:33 serZt2 /usr/local/sbin/kamailio[32302]: INFO: <core> [main.c:847]: sig_usr(): signal 15 received Dec 18 13:12:33 serZt2 /usr/local/sbin/kamailio[32298]: INFO: <core> [main.c:847]: sig_usr(): signal 15 received Dec 18 13:12:33 serZt2 /usr/local/sbin/kamailio[32300]: INFO: <core> [main.c:847]: sig_usr(): signal 15 received Dec 18 13:12:33 serZt2 /usr/local/sbin/kamailio[32295]: INFO: <core> [main.c:847]: sig_usr(): signal 15 received Dec 18 13:12:33 serZt2 /usr/local/sbin/kamailio[32289]: INFO: <core> [main.c:847]: sig_usr(): signal 15 received Dec 18 13:12:33 serZt2 /usr/local/sbin/kamailio[32291]: INFO: <core> [main.c:847]: sig_usr(): signal 15 received Dec 18 13:12:33 serZt2 /usr/local/sbin/kamailio[32304]: INFO: <core> [main.c:847]: sig_usr(): signal 15 received Dec 18 13:12:33 serZt2 /usr/local/sbin/kamailio[32288]: INFO: <core> [main.c:847]: sig_usr(): signal 15 received Dec 18 13:12:33 serZt2 /usr/local/sbin/kamailio[32285]: INFO: <core> [main.c:847]: sig_usr(): signal 15 received Dec 18 13:12:33 serZt2 /usr/local/sbin/kamailio[32286]: INFO: <core> [main.c:847]: sig_usr(): signal 15 received Dec 18 13:12:33 serZt2 /usr/local/sbin/kamailio[32287]: INFO: <core> [main.c:847]: sig_usr(): signal 15 received Dec 18 13:12:33 serZt2 /usr/local/sbin/kamailio[32294]: INFO: <core> [main.c:847]: sig_usr(): signal 15 received Dec 18 13:12:33 serZt2 /usr/local/sbin/kamailio[32283]: INFO: <core> [main.c:847]: sig_usr(): signal 15 received Dec 18 13:12:33 serZt2 /usr/local/sbin/kamailio[32292]: INFO: <core> [main.c:847]: sig_usr(): signal 15 received Dec 18 13:12:33 serZt2 /usr/local/sbin/kamailio[32281]: INFO: <core> [main.c:847]: sig_usr(): signal 15 received Dec 18 13:12:33 serZt2 /usr/local/sbin/kamailio[32278]: INFO: <core> [main.c:847]: sig_usr(): signal 15 received Dec 18 13:12:33 serZt2 /usr/local/sbin/kamailio[32301]: INFO: <core> [main.c:847]: sig_usr(): signal 15 received Dec 18 13:12:33 serZt2 /usr/local/sbin/kamailio[32296]: INFO: <core> [main.c:847]: sig_usr(): signal 15 received Dec 18 13:12:33 serZt2 /usr/local/sbin/kamailio[32280]: INFO: <core> [main.c:847]: sig_usr(): signal 15 received Dec 18 13:12:33 serZt2 /usr/local/sbin/kamailio[32297]: INFO: <core> [main.c:847]: sig_usr(): signal 15 received Dec 18 13:12:33 serZt2 /usr/local/sbin/kamailio[32282]: INFO: <core> [main.c:847]: sig_usr(): signal 15 received Dec 18 13:12:33 serZt2 /usr/local/sbin/kamailio[32279]: INFO: <core> [main.c:847]: sig_usr(): signal 15 received Dec 18 13:12:33 serZt2 /usr/local/sbin/kamailio[32293]: INFO: <core> [main.c:847]: sig_usr(): signal 15 received Dec 18 13:12:33 serZt2 /usr/local/sbin/kamailio[32284]: INFO: <core> [main.c:847]: sig_usr(): signal 15 received Dec 18 13:12:33 serZt2 /usr/local/sbin/kamailio[32305]: INFO: <core> [main.c:847]: sig_usr(): signal 15 received Dec 18 13:12:33 serZt2 /usr/local/sbin/kamailio[32306]: INFO: <core> [main.c:847]: sig_usr(): signal 15 received Dec 18 13:12:33 serZt2 /usr/local/sbin/kamailio[32308]: INFO: <core> [main.c:847]: sig_usr(): signal 15 received
```
#### Log Messages
<!-- Check the syslog file and if there are relevant log messages printed by Kamailio, add them next, or attach to issue, or provide a link to download them (e.g., to a pastebin site). -->
``` (paste your log messages here) ```
#### SIP Traffic
<!-- If the issue is exposed by processing specific SIP messages, grab them with ngrep or save in a pcap file, then add them next, or attach to issue, or provide a link to download them (e.g., to a pastebin site). -->
``` 2019/12/18 13:28:14.572182 81.31.45.41:5060 -> 192.168.144.33:5060 INVITE sip:533533619@192.168.144.33 SIP/2.0 Via: SIP/2.0/UDP 10.10.10.11:5060;rport;branch=z9hG4bKPjMoJzLYnz.bFfyeQgAkPu40nh00yPaZUM Max-Forwards: 70 From: sip:kovik@192.168.144.33;tag=AETpu82nyfAmiW96ruBDgrcHPm4w5Uc4 To: sip:533533619@192.168.144.33 Contact: sip:kovik@10.10.10.11:5060;ob Call-ID: .kat6b9EbVAbAm8hSTPXG9eU5lME79QG CSeq: 11527 INVITE Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS Supported: replaces, 100rel, timer, norefersub Session-Expires: 1800 Min-SE: 90 User-Agent: PJSUA v2.9-svn Linux-4.19.0.6/x86_64/glibc-2.28 Proxy-Authorization: Digest username="kovik", realm="192.168.144.33", nonce="Xfoqml36KW5qVYVrbT87WbA0jHDV9rwC", uri="sip:533533619@192.168.144.33", response="ffafbe076bbdd23fa83aeba0b6f16504" Content-Type: application/sdp Content-Length: 631
v=0 o=- 3785664489 3785664489 IN IP4 192.168.1.183 s=pjmedia b=AS:84 t=0 0 a=X-nat:0 m=audio 4000 RTP/AVP 96 97 98 99 3 0 8 9 120 121 122 c=IN IP4 192.168.1.183 b=TIAS:64000 a=rtcp:4001 IN IP4 192.168.1.183 a=sendrecv a=rtpmap:96 speex/16000 a=rtpmap:97 speex/8000 a=rtpmap:98 speex/32000 a=rtpmap:99 iLBC/8000 a=fmtp:99 mode=30 a=rtpmap:3 GSM/8000 a=rtpmap:0 PCMU/8000 a=rtpmap:8 PCMA/8000 a=rtpmap:9 G722/8000 a=rtpmap:120 telephone-event/16000 a=fmtp:120 0-16 a=rtpmap:121 telephone-event/8000 a=fmtp:121 0-16 a=rtpmap:122 telephone-event/32000 a=fmtp:122 0-16 a=ssrc:639673449 cname:4bdc5ad63943ba5b
```
### Possible Solutions
<!-- If you found a solution or workaround for the issue, describe it. Ideally, provide a pull request with a fix. -->
### Additional Information
* **Kamailio Version** - output of `kamailio -v`
``` version: kamailio 5.3.1 (x86_64/linux) 8d0d4e-dirty flags: USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MMAP, PKG_MALLOC, Q_MALLOC, F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLACKLIST, HAVE_RESOLV_RES, TLS_PTHREAD_MUTEX_SHARED ADAPTIVE_WAIT_LOOPS 1024, MAX_RECV_BUFFER_SIZE 262144, MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB poll method support: poll, epoll_lt, epoll_et, sigio_rt, select. id: 8d0d4e -dirty compiled on 08:29:21 Dec 18 2019 with gcc 8.3 ```
``` ruby -v ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-linux] ```
* **Operating System**:
<!-- Details about the operating system, the type: Linux (e.g.,: Debian 8.4, Ubuntu 16.04, CentOS 7.1, ...), MacOS, xBSD, Solaris, ...; Kernel details (output of `uname -a`) -->
``` lsb_release -a No LSB modules are available. Distributor ID: Debian Description: Debian GNU/Linux 10 (buster) Release: 10 Codename: buster
uname -a Linux serZt2 4.15.18-14-pve #1 SMP PVE 4.15.18-38 (Tue, 30 Apr 2019 10:51:33 +0200) x86_64 GNU/Linux
```